├── .gitignore ├── README.md ├── bin ├── memorydbmanager.html ├── runManager.bat ├── runManagerSwing.bat ├── runServer.bat ├── runUtil.bat └── runWebServer.bat ├── build ├── DocBookUtil.groovy ├── antivy-setup.xml ├── build-dist.gradle ├── build-dist.xml ├── build-docbook.xml ├── build.gradle ├── build.hsqldb.cmd ├── build.hsqldbtest.cmd ├── build.javadoc.cmd ├── build.sqltool.cmd ├── build.test.suite.cmd ├── build.xml ├── cfdistro.bash ├── clean.test.suite.cmd ├── dbuInstallSheetsWrapper.groovy ├── gradle-gui ├── gradle-gui.cmd ├── gradle-ivyxml-plugin-0.3.2.jar ├── gradle-javaPropFile-plugin-0.6.0.jar ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── gui-initial.setting ├── gui-welcome.txt ├── hsqldb.bnd ├── ivy.xml ├── ivysettings-sample.xml ├── jdkcodeswitch.list ├── mvn-pub.gradle ├── rng-catalog-template.xml ├── run.test.suite.cmd ├── setenv.cmd ├── settings.gradle ├── test.dbmd.convert.properties ├── test.properties └── test.xml ├── doc-src ├── altformats-sect.xml ├── apidocs │ ├── hsqldbs.png │ └── javadoc.css ├── branding-frag.xhtml ├── changelist_2_0.txt ├── docbook.css ├── entities │ ├── global.ent │ └── validation_only.ent ├── guide │ ├── accesscontrol.xml │ ├── building-app.xml │ ├── builtinfunctions.xml │ ├── compatibility.xml │ ├── dataaccess.xml │ ├── databaseobjects.xml │ ├── dbfiles-app.xml │ ├── dbproperties.xml │ ├── deployment.xml │ ├── dsndef.png │ ├── dsnoptions1.png │ ├── dsnoptions2.png │ ├── eclipse-gradle-cfg.png │ ├── eclipse-gradle-invoke.png │ ├── filelinks-app.xml │ ├── gradle-gui.png │ ├── guide.xml │ ├── listeners.xml │ ├── lists-app.xml │ ├── management.xml │ ├── odbc.xml │ ├── openoffice-app.xml │ ├── running.xml │ ├── sessions.xml │ ├── sqlgeneral.xml │ ├── sqlroutines.xml │ ├── texttables.xml │ ├── triggers.xml │ └── unix.xml ├── hsqldb_lic.txt ├── hypersonic_lic.txt ├── images │ ├── db │ │ ├── home.png │ │ ├── next.png │ │ ├── prev.png │ │ └── up.png │ ├── hypersql_logo.png │ └── hypersql_logo2.png ├── index.html ├── odbc.txt ├── readme-docauthors.txt ├── readme-template.txt ├── util-guide │ ├── entities │ │ └── versions.ent │ ├── filelinks-app.xml │ ├── html-report.png │ ├── rejreport-sample.png │ ├── sqltool-chapt.xml │ ├── systempls-app.xml │ └── util-guide.xml └── verbatim │ ├── sample │ ├── acl.txt │ ├── csv-sample.sql │ ├── dsv-sample.sql │ ├── hsqldb.cfg │ ├── hsqldb.init │ ├── html-report.sql │ ├── jaas.cfg │ ├── ldap-exerciser.properties │ ├── pl.sql │ ├── plsql.sql │ ├── sample.c │ ├── sample.php │ ├── sample.pl │ ├── sample.py │ ├── sample.sql │ ├── sampledata.sql │ ├── server.properties │ └── sqltool.rc │ ├── src │ └── org │ │ └── hsqldb │ │ ├── Tokens.java │ │ ├── Trigger.java │ │ ├── sample │ │ ├── SqlFileEmbedder.java │ │ ├── Testdb.java │ │ └── TriggerSample.java │ │ ├── server │ │ ├── Servlet.java │ │ └── WebServer.java │ │ └── test │ │ └── TestBase.java │ └── testrun │ └── sqltool │ ├── sqljrt.sql │ └── sqlpsm.sql ├── index.html ├── integration ├── extAuthWithSpring │ ├── build.xml │ ├── ivy-projsetup.xml │ ├── ivy.xml │ ├── ivysettings.xml │ ├── jul.properties │ ├── readme.txt │ ├── resources │ │ ├── beandefs.xml │ │ ├── jaasbeans.xml │ │ ├── jaasldapbeans.xml │ │ ├── ldapbeans.xml │ │ └── slavebeans.xml │ └── src │ │ └── org │ │ └── hsqldb │ │ └── sample │ │ ├── JdbcAppClass.java │ │ └── SpringExtAuth.java ├── jackrabbit │ ├── readme.txt │ └── resources │ │ └── org │ │ └── apache │ │ └── jackrabbit │ │ └── core │ │ ├── journal │ │ └── hsqldb.ddl │ │ └── persistence │ │ ├── bundle │ │ └── hsqldb.ddl │ │ └── db │ │ └── hsqldb.ddl └── readme.txt ├── lib └── servlet-2_3-fcs-classfiles.zip ├── my-docs └── 代码导读.java ├── my-test ├── java │ └── my │ │ └── test │ │ ├── HsqldbJdbcTest.java │ │ └── HsqldbServerStart.java └── resources │ ├── META-INF │ └── services │ │ └── java.sql.Driver │ └── server.properties ├── pom.xml ├── readme.txt ├── sample ├── StartupParameters.plist ├── acl.txt ├── csv-sample.sql ├── dsv-sample.sql ├── hsqldb.cfg ├── hsqldb.init ├── hsqldb.service ├── html-report.sql ├── j-sample.sql ├── jaas.cfg ├── ldap-exerciser.properties ├── load_binding_lu.sql ├── nullempty.sql ├── pl.sql ├── plsql.sql ├── sample.c ├── sample.dsv ├── sample.php ├── sample.pl ├── sample.py ├── sample.sql ├── sampledata.sql ├── server.properties └── sqltool.rc ├── src ├── module-info.java └── org │ └── hsqldb │ ├── ClientConnection.java │ ├── ClientConnectionHTTP.java │ ├── ColumnBase.java │ ├── ColumnSchema.java │ ├── Constraint.java │ ├── ConstraintCore.java │ ├── Database.java │ ├── DatabaseManager.java │ ├── DatabaseType.java │ ├── DatabaseURL.java │ ├── Expression.java │ ├── ExpressionAccessor.java │ ├── ExpressionAggregate.java │ ├── ExpressionArithmetic.java │ ├── ExpressionArrayAggregate.java │ ├── ExpressionBoolean.java │ ├── ExpressionColumn.java │ ├── ExpressionColumnAccessor.java │ ├── ExpressionLike.java │ ├── ExpressionLogical.java │ ├── ExpressionOp.java │ ├── ExpressionOrderBy.java │ ├── ExpressionPeriod.java │ ├── ExpressionPeriodOp.java │ ├── ExpressionTable.java │ ├── ExpressionValue.java │ ├── FunctionCustom.java │ ├── FunctionSQL.java │ ├── FunctionSQLInvoked.java │ ├── GroupSet.java │ ├── HsqlDateTime.java │ ├── HsqlException.java │ ├── HsqlNameManager.java │ ├── Like.java │ ├── NumberSequence.java │ ├── OpTypes.java │ ├── ParserBase.java │ ├── ParserCommand.java │ ├── ParserDDL.java │ ├── ParserDML.java │ ├── ParserDQL.java │ ├── ParserRoutine.java │ ├── ParserTable.java │ ├── PeriodDefinition.java │ ├── QueryExpression.java │ ├── QuerySpecification.java │ ├── RangeGroup.java │ ├── RangeVariable.java │ ├── RangeVariableJoined.java │ ├── RangeVariableResolver.java │ ├── ReferenceObject.java │ ├── Routine.java │ ├── RoutineSchema.java │ ├── Row.java │ ├── RowAVL.java │ ├── RowAVLDisk.java │ ├── RowAVLDiskData.java │ ├── RowAVLDiskLarge.java │ ├── RowAction.java │ ├── RowActionBase.java │ ├── RowDiskDataChange.java │ ├── Scanner.java │ ├── Schema.java │ ├── SchemaManager.java │ ├── SchemaObject.java │ ├── SchemaObjectSet.java │ ├── Server.java │ ├── Session.java │ ├── SessionContext.java │ ├── SessionData.java │ ├── SessionInterface.java │ ├── SessionManager.java │ ├── SetFunction.java │ ├── SetFunctionValueAggregate.java │ ├── SetFunctionValueArray.java │ ├── SetFunctionValueUser.java │ ├── SortAndSlice.java │ ├── SqlInvariants.java │ ├── Statement.java │ ├── StatementCommand.java │ ├── StatementCompound.java │ ├── StatementCursor.java │ ├── StatementDML.java │ ├── StatementDMQL.java │ ├── StatementExpression.java │ ├── StatementHandler.java │ ├── StatementInsert.java │ ├── StatementManager.java │ ├── StatementProcedure.java │ ├── StatementQuery.java │ ├── StatementResultUpdate.java │ ├── StatementSchema.java │ ├── StatementSchemaDefinition.java │ ├── StatementSession.java │ ├── StatementSet.java │ ├── StatementSignal.java │ ├── StatementSimple.java │ ├── StatementTypes.java │ ├── Table.java │ ├── TableBase.java │ ├── TableDerived.java │ ├── TablePeriodWorks.java │ ├── TableUtil.java │ ├── TableWorks.java │ ├── TextTable.java │ ├── Token.java │ ├── Tokens.java │ ├── TransactionManager.java │ ├── TransactionManager2PL.java │ ├── TransactionManagerCommon.java │ ├── TransactionManagerMV2PL.java │ ├── TransactionManagerMVCC.java │ ├── Trigger.java │ ├── TriggerDef.java │ ├── TriggerDefSQL.java │ ├── TypeInvariants.java │ ├── View.java │ ├── auth │ ├── AuthBeanMultiplexer.java │ ├── AuthFunctionBean.java │ ├── AuthUtils.java │ ├── DenyException.java │ ├── HsqldbSlaveAuthBean.java │ ├── JaasAuthBean.java │ ├── LdapAuthBean.java │ └── LdapAuthBeanTester.java │ ├── cmdline │ ├── SqlFile.java │ ├── SqlTool.java │ ├── SqlToolError.java │ ├── SqlToolSprayer.java │ ├── SqltoolRB.java │ ├── package.html │ ├── sqltool.flex │ ├── sqltool.properties │ ├── sqltool │ │ ├── Calculator.java │ │ ├── FileRecordReader.java │ │ ├── SqlFile.banner.text │ │ ├── SqlFile.banner_de.text │ │ ├── SqlFileScanner.java │ │ ├── SqlTool.syntax.text │ │ ├── SqlTool.syntax_de.text │ │ ├── Token.java │ │ ├── TokenList.java │ │ ├── TokenSource.java │ │ ├── bottom-boilerplate.html │ │ ├── buffer.help.text │ │ ├── buffer.help_de.text │ │ ├── d.options.text │ │ ├── d.options_de.text │ │ ├── dsv.options.text │ │ ├── dsv.options_de.text │ │ ├── errorat.text │ │ ├── errorat_de.text │ │ ├── macro.help.text │ │ ├── macro.help_de.text │ │ ├── pl.assign.text │ │ ├── pl.control.text │ │ ├── pl.help.text │ │ ├── pl.help_de.text │ │ ├── raw.leadin.text │ │ ├── raw.leadin_de.text │ │ ├── rejectreport.bottom.text │ │ ├── rejectreport.bottom_de.text │ │ ├── rejectreport.row.text │ │ ├── rejectreport.top.text │ │ ├── rejectreport.top_de.text │ │ ├── special.help.text │ │ ├── special.help_de.text │ │ └── top-boilerplate.html │ ├── sqltool_de.properties │ └── sqltool_nl.properties │ ├── dbinfo │ ├── DITableInfo.java │ ├── DatabaseInformation.java │ ├── DatabaseInformationFull.java │ └── DatabaseInformationMain.java │ ├── error │ ├── Error.java │ └── ErrorCode.java │ ├── index │ ├── Index.java │ ├── IndexAVL.java │ ├── IndexAVLCheck.java │ ├── IndexAVLMemory.java │ ├── IndexStats.java │ ├── NodeAVL.java │ ├── NodeAVLDisk.java │ └── NodeAVLDiskLarge.java │ ├── jdbc │ ├── JDBCArray.java │ ├── JDBCArrayBasic.java │ ├── JDBCBlob.java │ ├── JDBCBlobClient.java │ ├── JDBCBlobFile.java │ ├── JDBCCallableStatement.java │ ├── JDBCClob.java │ ├── JDBCClobClient.java │ ├── JDBCClobFile.java │ ├── JDBCColumnMetaData.java │ ├── JDBCCommonDataSource.java │ ├── JDBCConnection.java │ ├── JDBCConnectionEventListener.java │ ├── JDBCDataSource.java │ ├── JDBCDataSourceFactory.java │ ├── JDBCDatabaseMetaData.java │ ├── JDBCDriver.java │ ├── JDBCNClob.java │ ├── JDBCParameterMetaData.java │ ├── JDBCPool.java │ ├── JDBCPreparedStatement.java │ ├── JDBCResultSet.java │ ├── JDBCResultSetMetaData.java │ ├── JDBCRowId.java │ ├── JDBCSQLXML.java │ ├── JDBCSavepoint.java │ ├── JDBCStatement.java │ ├── JDBCStatementBase.java │ ├── JDBCUtil.java │ ├── package.html │ └── pool │ │ ├── JDBCPooledConnection.java │ │ ├── JDBCPooledDataSource.java │ │ ├── JDBCXAConnection.java │ │ ├── JDBCXAConnectionWrapper.java │ │ ├── JDBCXADataSource.java │ │ ├── JDBCXAResource.java │ │ └── JDBCXID.java │ ├── jdbcDriver.java │ ├── lib │ ├── AppendableException.java │ ├── ArrayCounter.java │ ├── ArrayListIdentity.java │ ├── ArraySort.java │ ├── ArrayUtil.java │ ├── BaseList.java │ ├── BasicTextJdkLogFormatter.java │ ├── CharArrayWriter.java │ ├── ClosableByteArrayOutputStream.java │ ├── ClosableCharArrayWriter.java │ ├── Collection.java │ ├── CountUpDownLatch.java │ ├── CountdownInputStream.java │ ├── DataOutputStream.java │ ├── DoubleIntIndex.java │ ├── DoubleLongIndex.java │ ├── FileAccess.java │ ├── FileArchiver.java │ ├── FileUtil.java │ ├── FrameworkLogger.java │ ├── HashMap.java │ ├── HashMappedList.java │ ├── HashSet.java │ ├── HsqlArrayHeap.java │ ├── HsqlArrayList.java │ ├── HsqlByteArrayInputStream.java │ ├── HsqlByteArrayOutputStream.java │ ├── HsqlDeque.java │ ├── HsqlHeap.java │ ├── HsqlList.java │ ├── HsqlTaskQueue.java │ ├── HsqlThreadFactory.java │ ├── HsqlTimer.java │ ├── InOutUtil.java │ ├── InputStreamInterface.java │ ├── InputStreamWrapper.java │ ├── IntIndex.java │ ├── IntKeyHashMap.java │ ├── IntKeyHashMapConcurrent.java │ ├── IntKeyIntValueHashMap.java │ ├── IntKeyLongValueHashMap.java │ ├── IntLookup.java │ ├── IntValueHashMap.java │ ├── Iterator.java │ ├── KMPSearchAlgorithm.java │ ├── LineGroupReader.java │ ├── LineReader.java │ ├── LongDeque.java │ ├── LongKeyHashMap.java │ ├── LongKeyIntValueHashMap.java │ ├── LongKeyLongValueHashMap.java │ ├── LongLookup.java │ ├── LongValueHashMap.java │ ├── MultiValueHashMap.java │ ├── Notified.java │ ├── ObjectComparator.java │ ├── OrderedHashSet.java │ ├── OrderedIntHashSet.java │ ├── OrderedIntKeyHashMap.java │ ├── OrderedLongHashSet.java │ ├── OrderedLongKeyHashMap.java │ ├── RCData.java │ ├── ReadWriteLockDummy.java │ ├── ReaderInputStream.java │ ├── RefCapablePropertyResourceBundle.java │ ├── RefCapableRBInterface.java │ ├── Set.java │ ├── SimpleLog.java │ ├── StopWatch.java │ ├── Storage.java │ ├── StringComparator.java │ ├── StringConverter.java │ ├── StringInputStream.java │ ├── StringUtil.java │ ├── ThreadFactory.java │ ├── ValidatingResourceBundle.java │ ├── WrapperIterator.java │ ├── java │ │ └── JavaSystem.java │ ├── package.html │ └── tar │ │ ├── DbBackup.java │ │ ├── DbBackupMain.java │ │ ├── PIFData.java │ │ ├── PIFGenerator.java │ │ ├── RB.java │ │ ├── TarFileInputStream.java │ │ ├── TarFileOutputStream.java │ │ ├── TarGenerator.java │ │ ├── TarGeneratorMain.java │ │ ├── TarHeaderField.java │ │ ├── TarMalformatException.java │ │ ├── TarReader.java │ │ ├── TarReaderMain.java │ │ ├── package.html │ │ ├── rb.properties │ │ ├── rb │ │ ├── DbBackup.syntax.text │ │ ├── DbBackup.syntax_de.text │ │ ├── TarGenerator.syntax.text │ │ ├── TarGenerator.syntax_de.text │ │ ├── TarReader.syntax.text │ │ ├── TarReader.syntax_de.text │ │ ├── listing.format.text │ │ └── listing.format_de.text │ │ └── rb_de.properties │ ├── map │ ├── BaseHashMap.java │ ├── BitMap.java │ ├── HashIndex.java │ ├── ReusableObjectCache.java │ ├── ValuePool.java │ └── ValuePoolHashMap.java │ ├── navigator │ ├── RangeIterator.java │ ├── RowIterator.java │ ├── RowSetNavigator.java │ ├── RowSetNavigatorClient.java │ ├── RowSetNavigatorData.java │ ├── RowSetNavigatorDataChange.java │ ├── RowSetNavigatorDataChangeMemory.java │ └── RowSetNavigatorDataTable.java │ ├── package.html │ ├── persist │ ├── BitMapCachedObject.java │ ├── BlockObjectStore.java │ ├── Cache.java │ ├── CachedObject.java │ ├── CachedObjectBase.java │ ├── Crypto.java │ ├── DataFileCache.java │ ├── DataFileCacheSession.java │ ├── DataFileDefrag.java │ ├── DataSpaceManager.java │ ├── DataSpaceManagerBlocks.java │ ├── DataSpaceManagerSimple.java │ ├── DirectoryBlockCachedObject.java │ ├── DoubleIntArrayCachedObject.java │ ├── EventLogInterface.java │ ├── HsqlDatabaseProperties.java │ ├── HsqlProperties.java │ ├── IntArrayCachedObject.java │ ├── LobManager.java │ ├── LobStore.java │ ├── LobStoreInJar.java │ ├── LobStoreMem.java │ ├── LobStoreRAFile.java │ ├── LockFile.java │ ├── Log.java │ ├── Logger.java │ ├── PersistentStore.java │ ├── PersistentStoreCollection.java │ ├── PersistentStoreCollectionDatabase.java │ ├── PersistentStoreCollectionSession.java │ ├── RAFile.java │ ├── RAFileHybrid.java │ ├── RAFileInJar.java │ ├── RAFileNIO.java │ ├── RAFileSimple.java │ ├── RAShadowFile.java │ ├── RAStorageWrapper.java │ ├── RandomAccessInterface.java │ ├── RowInsertInterface.java │ ├── RowInsertSimple.java │ ├── RowInsertVersioning.java │ ├── RowStoreAVL.java │ ├── RowStoreAVLDisk.java │ ├── RowStoreAVLDiskData.java │ ├── RowStoreAVLHybrid.java │ ├── RowStoreAVLHybridExtended.java │ ├── RowStoreAVLMemory.java │ ├── RowStoreDataChange.java │ ├── ScriptLoader.java │ ├── ScriptRunner.java │ ├── SimpleStore.java │ ├── TableSpaceManager.java │ ├── TableSpaceManagerBlocks.java │ ├── TableSpaceManagerSimple.java │ ├── TextCache.java │ ├── TextFileReader.java │ ├── TextFileReader16.java │ ├── TextFileReader8.java │ ├── TextFileSettings.java │ └── TextTableStorageManager.java │ ├── resources │ ├── ResourceBundleHandler.java │ ├── info-column-remarks.properties │ ├── info-table-remarks.properties │ ├── information-schema.sql │ ├── jdklogging-default.properties │ ├── lob-schema.sql │ ├── org_hsqldb_DatabaseClassLoader.properties │ ├── org_hsqldb_server_Server_messages.properties │ ├── sql-state-messages.properties │ ├── sql-state-messages_es.properties │ ├── webserver-content-types.properties │ └── webserver-pages.properties │ ├── result │ ├── Result.java │ ├── ResultConstants.java │ ├── ResultLob.java │ ├── ResultMetaData.java │ └── ResultProperties.java │ ├── rights │ ├── GrantConstants.java │ ├── Grantee.java │ ├── GranteeManager.java │ ├── Right.java │ ├── User.java │ └── UserManager.java │ ├── rowio │ ├── RowInputBase.java │ ├── RowInputBinary.java │ ├── RowInputBinary180.java │ ├── RowInputBinaryDecode.java │ ├── RowInputInterface.java │ ├── RowInputText.java │ ├── RowInputTextLog.java │ ├── RowInputTextQuoted.java │ ├── RowOutputBase.java │ ├── RowOutputBinary.java │ ├── RowOutputBinary180.java │ ├── RowOutputBinaryEncode.java │ ├── RowOutputInterface.java │ ├── RowOutputText.java │ ├── RowOutputTextLog.java │ └── RowOutputTextQuoted.java │ ├── sample │ ├── ConnectionTypesSample.java │ ├── DatabaseManagerSample.java │ ├── FindFile.java │ ├── SqlFileEmbedder.java │ ├── Testdb.java │ ├── TriggerSample.java │ └── package.html │ ├── scriptio │ ├── ScriptReaderBase.java │ ├── ScriptReaderDecode.java │ ├── ScriptReaderText.java │ ├── ScriptWriterBase.java │ ├── ScriptWriterEncode.java │ ├── ScriptWriterText.java │ └── StatementLineTypes.java │ ├── server │ ├── HsqlServerFactory.java │ ├── HsqlSocketFactory.java │ ├── HsqlSocketFactorySecure.java │ ├── HsqlSocketRequestHandler.java │ ├── OdbcPacketInputStream.java │ ├── OdbcPacketOutputStream.java │ ├── OdbcPreparedStatement.java │ ├── OdbcUtil.java │ ├── PgType.java │ ├── RecoverableOdbcFailure.java │ ├── Server.java │ ├── ServerAcl.java │ ├── ServerConfiguration.java │ ├── ServerConnection.java │ ├── ServerConstants.java │ ├── ServerProperties.java │ ├── Servlet.java │ ├── StatementPortal.java │ ├── WebServer.java │ ├── WebServerConnection.java │ └── package.html │ ├── test │ ├── AllTests.java │ ├── BlaineTrig.java │ ├── ClearTests.java │ ├── JDBCBench.java │ ├── TestAcl.java │ ├── TestAllTypes.java │ ├── TestBase.java │ ├── TestBench.java │ ├── TestCacheSize.java │ ├── TestCascade.java │ ├── TestCollation.java │ ├── TestDataCube.java │ ├── TestDataStructures.java │ ├── TestDatabaseMetaData.java │ ├── TestDateTime.java │ ├── TestDatetimeSimple.java │ ├── TestDbBackup.java │ ├── TestDirectorySettings.java │ ├── TestGroupByHaving.java │ ├── TestHTTPKeepAlive.java │ ├── TestHarness.java │ ├── TestHashStructures.java │ ├── TestINPredicateParameterizationAndCorrelation.java │ ├── TestInstantiation.java │ ├── TestJDBCGeneratedColumns.java │ ├── TestJDBCSavepoints.java │ ├── TestJavaFunctions.java │ ├── TestKarl.java │ ├── TestLibSpeed.java │ ├── TestLikePredicateOptimizations.java │ ├── TestLobs.java │ ├── TestMerge.java │ ├── TestMultiInsert.java │ ├── TestNullInUnion.java │ ├── TestPeriodPredicates.java │ ├── TestPreparedStatements.java │ ├── TestPreparedSubQueries.java │ ├── TestQuotes.java │ ├── TestSchemaParse.java │ ├── TestScript.java │ ├── TestScriptRunner.java │ ├── TestScripts.java │ ├── TestSql.java │ ├── TestSqlPeriodPredicates.java │ ├── TestSqlPersistent.java │ ├── TestStoredProcedure.java │ ├── TestSubQueriesInPreparedStatements.java │ ├── TestSubselect.java │ ├── TestTextTable.java │ ├── TestTextTables.java │ ├── TestTriggers.java │ ├── TestTypeConversion.java │ ├── TestUpdatableResultSets.java │ ├── TestUpdatableResults.java │ ├── TestUtil.java │ ├── TestViewAsterisks.java │ ├── TriggerClass.java │ ├── Waiter.java │ └── odbc │ │ ├── TestOdbcBase.java │ │ ├── TestOdbcService.java │ │ └── TestOdbcTypes.java │ ├── trigger │ └── Trigger.java │ ├── types │ ├── ArrayType.java │ ├── BinaryData.java │ ├── BinaryType.java │ ├── BinaryUUIDType.java │ ├── BitType.java │ ├── BlobData.java │ ├── BlobDataID.java │ ├── BlobInputStream.java │ ├── BlobType.java │ ├── BooleanType.java │ ├── CharacterType.java │ ├── Charset.java │ ├── ClobData.java │ ├── ClobDataID.java │ ├── ClobInputStream.java │ ├── ClobType.java │ ├── Collation.java │ ├── DTIType.java │ ├── DateTimeType.java │ ├── IntervalMonthData.java │ ├── IntervalSecondData.java │ ├── IntervalType.java │ ├── JavaObjectData.java │ ├── JavaObjectDataInternal.java │ ├── LobData.java │ ├── NullType.java │ ├── NumberType.java │ ├── OtherType.java │ ├── RowType.java │ ├── TimeData.java │ ├── TimestampData.java │ ├── Type.java │ ├── TypedComparator.java │ ├── Types.java │ └── UserTypeModifier.java │ └── util │ ├── Bold.gif │ ├── CSVWriter.java │ ├── Clear.png │ ├── Close.png │ ├── CodeSwitcher.java │ ├── Colors.png │ ├── CommonSwing.java │ ├── ConnectionDialog.java │ ├── ConnectionDialogCommon.java │ ├── ConnectionDialogSwing.java │ ├── ConnectionSetting.java │ ├── DataAccessPoint.java │ ├── DataAccessPointException.java │ ├── DatabaseManager.java │ ├── DatabaseManagerCommon.java │ ├── DatabaseManagerSwing.java │ ├── FontDialogSwing.java │ ├── GreenCircle.gif │ ├── Grid.java │ ├── GridSwing.java │ ├── HelperFactory.java │ ├── Hourglass.gif │ ├── HsqldbTransferHelper.java │ ├── InformixTransferHelper.java │ ├── Italic.gif │ ├── JDBCTypes.java │ ├── MainInvoker.java │ ├── McKoiTransferHelper.java │ ├── NoWay.gif │ ├── OracleTransferHelper.java │ ├── PostgresTransferHelper.java │ ├── RedCircle.gif │ ├── SQLStatements.java │ ├── SqlServerTransferHelper.java │ ├── TableSorter.java │ ├── Traceable.java │ ├── Transfer.java │ ├── TransferCommon.java │ ├── TransferDb.java │ ├── TransferHelper.java │ ├── TransferResultSet.java │ ├── TransferSQLText.java │ ├── TransferTable.java │ ├── Tree.java │ ├── hsqldb.gif │ ├── hsqldbtab.gif │ ├── preprocessor │ ├── AntResolver.java │ ├── BasicResolver.java │ ├── Defines.java │ ├── Document.java │ ├── IResolver.java │ ├── Line.java │ ├── LineType.java │ ├── Option.java │ ├── Parser.java │ ├── Preprocessor.java │ ├── PreprocessorAntTask.java │ ├── PreprocessorException.java │ ├── Token.java │ └── Tokenizer.java │ ├── problems.gif │ ├── run_exc.gif │ └── run_exc_running.gif ├── stylesheets ├── chunk.xsl ├── fo.xsl ├── html-common.xsl ├── html.xsl └── pagesetup.xsl ├── test-src └── org │ └── hsqldb │ ├── ClientConnectionTest.java │ ├── DatabaseURLTest.java │ ├── ScannerTest.java │ ├── auth │ ├── AuthBeanMultiplexerTest.java │ ├── AuthFunctionTest.java │ ├── AuthFunctionUtils.java │ ├── AuthSuite.java │ ├── JaasAuthBeanTest.java │ ├── SlaveAuthBeanTest.java │ └── StartCharModule.java │ ├── cmdline │ ├── SqlFileScannerDriver.java │ └── SqltoolRBTest.java │ ├── jdbc │ ├── Customer.java │ ├── CustomerDao.java │ ├── JDBCArrayTest.java │ ├── JDBCBlobClientTest.java │ ├── JDBCBlobFileTest.java │ ├── JDBCBlobTest.java │ ├── JDBCCallableStatementTest.java │ ├── JDBCCallableStatementWhileClosedTest.java │ ├── JDBCClobClientTest.java │ ├── JDBCClobFileTest.java │ ├── JDBCClobTest.java │ ├── JDBCConnectionCreateStatementTest.java │ ├── JDBCConnectionPrepareCallTest.java │ ├── JDBCConnectionPrepareStatementTest.java │ ├── JDBCConnectionTest.java │ ├── JDBCDataSourceFactoryTest.java │ ├── JDBCDataSourceTest.java │ ├── JDBCDatabaseMetaDataSupportsConvertTest.java │ ├── JDBCDatabaseMetaDataTest.java │ ├── JDBCDriverTest.java │ ├── JDBCNClobTest.java │ ├── JDBCParameterMetaDataTest.java │ ├── JDBCPoolTest.java │ ├── JDBCPreparedStatementTest.java │ ├── JDBCResultSetMetaDataTest.java │ ├── JDBCResultSetTest.java │ ├── JDBCRowIdTest.java │ ├── JDBCSQLXMLTest.java │ ├── JDBCSavepointTest.java │ ├── JDBCStatementTest.java │ ├── JdbcSuite.java │ ├── ScriptedTest.java │ ├── UtilTest.java │ ├── pool │ │ ├── JDBCPooledDataSourceTest.java │ │ ├── JDBCXAConnectionTest.java │ │ ├── JDBCXAConnectionWrapperTest.java │ │ ├── JDBCXADataSourceTest.java │ │ ├── JDBCXAResourceTest.java │ │ ├── JDBCXIDTest.java │ │ └── PoolSuite.java │ ├── populate-all_types-table.sql │ ├── resources │ │ ├── sql │ │ │ ├── TestSelf.txt │ │ │ ├── TestSelf3PartNames.txt │ │ │ ├── TestSelfAlterColumn.txt │ │ │ ├── TestSelfArithmetic.txt │ │ │ ├── TestSelfArrays.txt │ │ │ ├── TestSelfCasewhen.txt │ │ │ ├── TestSelfCheckConstraints.txt │ │ │ ├── TestSelfColGrant.txt │ │ │ ├── TestSelfConstraints.txt │ │ │ ├── TestSelfConversions.txt │ │ │ ├── TestSelfCreate.txt │ │ │ ├── TestSelfFKModes.txt │ │ │ ├── TestSelfFieldLimits.txt │ │ │ ├── TestSelfFunction.txt │ │ │ ├── TestSelfGrantees.txt │ │ │ ├── TestSelfGroupBy.txt │ │ │ ├── TestSelfImmediateShutdown.txt │ │ │ ├── TestSelfImmediateShutdownRecover.txt │ │ │ ├── TestSelfInPredicate.txt │ │ │ ├── TestSelfInPredicateReferencing.txt │ │ │ ├── TestSelfInsertDeleteQueries.txt │ │ │ ├── TestSelfInsteadOfTriggers.txt │ │ │ ├── TestSelfInternalFunctions.txt │ │ │ ├── TestSelfInterval.txt │ │ │ ├── TestSelfIssues.txt │ │ │ ├── TestSelfJoins.txt │ │ │ ├── TestSelfLeftJoin.txt │ │ │ ├── TestSelfModify.txt │ │ │ ├── TestSelfMultiGrants.txt │ │ │ ├── TestSelfNameResolution.txt │ │ │ ├── TestSelfNameResolutionSchemas.txt │ │ │ ├── TestSelfNoDmlBug1.txt │ │ │ ├── TestSelfNoDmlBug2.txt │ │ │ ├── TestSelfNot.txt │ │ │ ├── TestSelfOrderLimits.txt │ │ │ ├── TestSelfPersSchemA.txt │ │ │ ├── TestSelfPersSchemB.txt │ │ │ ├── TestSelfPersSchemC.txt │ │ │ ├── TestSelfPersSchemD.txt │ │ │ ├── TestSelfPrimaryKeys.txt │ │ │ ├── TestSelfQueries.txt │ │ │ ├── TestSelfRightCaching.txt │ │ │ ├── TestSelfRoleNesting.txt │ │ │ ├── TestSelfSchemaCasc.txt │ │ │ ├── TestSelfSchemaMisc.txt │ │ │ ├── TestSelfSchemaPerCachTbl1.txt │ │ │ ├── TestSelfSchemaPerCachTbl2.txt │ │ │ ├── TestSelfSchemaPersistA1.txt │ │ │ ├── TestSelfSchemaPersistA2.txt │ │ │ ├── TestSelfSchemaPersistB1.txt │ │ │ ├── TestSelfSchemaPersistB2.txt │ │ │ ├── TestSelfSchemaPersistC1.txt │ │ │ ├── TestSelfSchemaPersistC2.txt │ │ │ ├── TestSelfSchemaQuoting.txt │ │ │ ├── TestSelfSeqRightsA.txt │ │ │ ├── TestSelfSeqRightsB.txt │ │ │ ├── TestSelfSeqRightsC.txt │ │ │ ├── TestSelfStoredProcedure.txt │ │ │ ├── TestSelfStoredProcedureTypes.txt │ │ │ ├── TestSelfSubselects.txt │ │ │ ├── TestSelfSysTables.txt │ │ │ ├── TestSelfTempTable1.txt │ │ │ ├── TestSelfTempTable2.txt │ │ │ ├── TestSelfTransaction.txt │ │ │ ├── TestSelfTriggers.txt │ │ │ ├── TestSelfTriggers2.txt │ │ │ ├── TestSelfTrimSimplified.txt │ │ │ ├── TestSelfUnions.txt │ │ │ ├── TestSelfUserFunction.txt │ │ │ ├── TestSelfVerify.txt │ │ │ ├── TestSelfViewGrants.txt │ │ │ ├── TestSelfViewSchemaResolve.txt │ │ │ ├── TestSelfViews.txt │ │ │ ├── TestText01.txt │ │ │ ├── TestText02.txt │ │ │ └── TestTriggers.txt │ │ └── xml │ │ │ ├── MyDoc.xml.zip │ │ │ ├── MyEntity.ent │ │ │ ├── mydoc_1_0.dtd │ │ │ ├── websvc_ref.dtd │ │ │ └── websvc_ref.xml.zip │ ├── setup-all_array_types-table.sql │ ├── setup-all_types-table.sql │ ├── setup-dual-table.sql │ ├── setup-jdbc_required_get_xxx-table.sql │ ├── setup-sample-data-tables.sql │ └── testbase │ │ ├── BaseArrayTestCase.java │ │ ├── BaseBlobTestCase.java │ │ ├── BaseCallableStatementTestCase.java │ │ ├── BaseClobTestCase.java │ │ ├── BaseDatabaseMetaDataSupportsConvertTestCase.java │ │ ├── BaseDatabaseMetaDataTestCase.java │ │ ├── BaseDriverTestCase.java │ │ ├── BaseJdbcTestCase.java │ │ ├── BaseResultSetMetaDataTestCase.java │ │ ├── DatabaseMetaDataDefaultValues.java │ │ └── SqlState.java │ ├── lib │ ├── ArrayUtilTest.java │ ├── DoubleIntIndexTest.java │ ├── FileAccessResTest.java │ ├── HsqlArrayHeapTest.java │ ├── HsqlDequeTest.java │ ├── HsqlTimerTest.java │ ├── TestWrapperIterator.java │ └── tar │ │ └── PIFGeneratorTest.java │ ├── map │ ├── BitMapTest.java │ └── ValuePoolHashMapTest.java │ ├── persist │ └── HsqlPropertiesTest.java │ ├── resources │ ├── jaas.cfg │ ├── odbcPacket.data │ ├── pif.data │ ├── sqlstate-condition.properties │ ├── sqlstate-subcondition.properties │ ├── test-dbmd-convert.properties │ └── test.properties │ ├── server │ ├── OdbcPacketInputStreamTest.java │ ├── OdbcPacketOutputStreamTest.java │ └── ServerSuite.java │ ├── testbase │ ├── BaseScriptedTestCase.java │ ├── BaseTestCase.java │ ├── ConnectionFactory.java │ ├── ForSubject.java │ ├── HsqldbEmbeddedDatabaseCloser.java │ ├── HsqldbEmbeddedDatabaseDeleter.java │ ├── OfMethod.java │ ├── PropertyGetter.java │ └── ScriptIterator.java │ ├── types │ └── IntervalTypeTest.java │ └── util │ └── preprocessor │ ├── ATest.exp │ ├── ATest.src │ ├── Jdbc2.inc │ ├── Jdbc3.inc │ ├── Jdbc4.inc │ ├── Main.inc │ ├── OptionTest.java │ ├── PreprocessorSuite.java │ └── PreprocessorTest.java └── testrun ├── hsqldb ├── TestSelf.txt ├── TestSelf3PartNames.txt ├── TestSelfAlterColumn.txt ├── TestSelfArithmetic.txt ├── TestSelfArrays.txt ├── TestSelfCasewhen.txt ├── TestSelfCheckConstraints.txt ├── TestSelfColGrant.txt ├── TestSelfConstraints.txt ├── TestSelfConversions.txt ├── TestSelfCreate.txt ├── TestSelfFKModes.txt ├── TestSelfFieldLimits.txt ├── TestSelfFunction.txt ├── TestSelfGrantees.txt ├── TestSelfGroupBy.txt ├── TestSelfImmediateShutdown.txt ├── TestSelfImmediateShutdownRecover.txt ├── TestSelfInPredicateReferencing.txt ├── TestSelfInsertDeleteQueries.txt ├── TestSelfInsteadOfTriggers.txt ├── TestSelfInternalFunctions.txt ├── TestSelfInterval.txt ├── TestSelfIssues.txt ├── TestSelfJoins.txt ├── TestSelfLeftJoin.txt ├── TestSelfModify.txt ├── TestSelfMultiGrants.txt ├── TestSelfNameResolution.txt ├── TestSelfNameResolutionSchemas.txt ├── TestSelfNoDmlBug1.txt ├── TestSelfNoDmlBug2.txt ├── TestSelfNot.txt ├── TestSelfPersSchemA.txt ├── TestSelfPersSchemB.txt ├── TestSelfPersSchemC.txt ├── TestSelfPersSchemD.txt ├── TestSelfPrimaryKeys.txt ├── TestSelfQueries.txt ├── TestSelfRightCaching.txt ├── TestSelfRoleNesting.txt ├── TestSelfSchemaCasc.txt ├── TestSelfSchemaMisc.txt ├── TestSelfSchemaPerCachTbl1.txt ├── TestSelfSchemaPerCachTbl2.txt ├── TestSelfSchemaPersistA1.txt ├── TestSelfSchemaPersistA2.txt ├── TestSelfSchemaPersistB1.txt ├── TestSelfSchemaPersistB2.txt ├── TestSelfSchemaPersistC1.txt ├── TestSelfSchemaPersistC2.txt ├── TestSelfSchemaQuoting.txt ├── TestSelfSeqRightsA.txt ├── TestSelfSeqRightsB.txt ├── TestSelfSeqRightsC.txt ├── TestSelfStoredProcedure.txt ├── TestSelfStoredProcedureTypes.txt ├── TestSelfSubselects.txt ├── TestSelfSysTables.txt ├── TestSelfTempTable1.txt ├── TestSelfTempTable2.txt ├── TestSelfTransaction.txt ├── TestSelfTriggers.txt ├── TestSelfTriggers2.txt ├── TestSelfTrimSimplified.txt ├── TestSelfUnions.txt ├── TestSelfUserFunction.txt ├── TestSelfVerify.txt ├── TestSelfViewGrants.txt ├── TestSelfViewSchemaResolve.txt ├── TestSelfViews.txt ├── TestText01.txt ├── TestText02.txt └── TestTriggers.txt ├── hsqlodbc └── blobtest.py └── sqltool ├── README.txt ├── adv-comments.sql ├── altspace.targtbl.dsv ├── append.inter ├── at-chainer.sql ├── badsqlonly.nsql ├── buffer-vars.sql ├── build.gradle ├── comments.sql ├── csv-1charquoted.csv ├── csv-1charquoted.sql ├── csv-quotedcolheaders.csv ├── csv-quotedcolheaders.sql ├── csv-roundtrip.sql ├── dsv-abortcommits.sql ├── dsv-altspace.sql ├── dsv-constcols.dsv ├── dsv-constcols.sql ├── dsv-multiline.sql ├── dsv-omits.dsv ├── dsv-omits.sql ├── dsv-prepare.sql ├── dsv-rejects.dsv ├── dsv-rejects.sql ├── dsv-roundtrip.sql ├── dsv-rpcommit.dsv ├── dsv-rpcommit.sql ├── dsv-sqlarray.sql ├── dsv-trimall.dsv ├── dsv-trimall.sql ├── dsv-trimming-alt.dsv ├── dsv-trimming.dsv ├── dsv-trimming.sql ├── else.sql ├── errhandling.isql ├── errhandling.nsql ├── errhandling.sql ├── errhandlingn.isql ├── for.sql ├── forrows.sql ├── function.sql ├── goodsqlonly.sql ├── history.inter ├── inlineif.sql ├── j.sql ├── lastval.sql ├── logic.sql ├── logical-ops.sql ├── macro.inter ├── macro.sql ├── math.sql ├── nestingschema.sql ├── noop.sql ├── nq-arg1.isql ├── nq-arg1.nsql ├── nq-noarg1.isql ├── nq-noarg1.sql ├── nullempty.sql ├── nullrep-alt.dsv ├── nullrep.dsv ├── nullrep.sql ├── plcontrolflow.sql ├── q-arg1.nsql ├── q-noarg1.sql ├── rawmode.sql ├── return.isql ├── return.sql ├── rowcount.sql ├── runtests.bash ├── runtests.cmd ├── runtests.groovy ├── sqlarray.sql ├── sqljrt.sql ├── sqlpsm.sql ├── subdir ├── atuser.sql ├── tblx.dsv └── tblx.sql ├── subst.inter ├── testcases.txt ├── unseteval.nsql ├── unsetvar.nsql ├── unsetvar.sql ├── urlnester.sql ├── varnestee.isql ├── varnester.sql ├── vars.sql ├── varswithspaces.sql └── write.inter /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /.settings/ 3 | /.classpath 4 | /.project 5 | /dist/ 6 | /build/ 7 | /nbproject/ 8 | /data/ 9 | /error.lock 10 | /error.txt 11 | /test.out.txt 12 | .DS_Store 13 | /.idea/ 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .checkstyle 18 | /temp/ 19 | /h2web/ 20 | .pmd 21 | docs/html/testOutput.html 22 | target 23 | .settings 24 | .classpath 25 | .project 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 项目用途 2 | 3 | * [HSQLDB数据库](http://www.hsqldb.org/) 源代码学习研究(包括代码注释、文档、用于代码分析的测试用例) 4 | 5 | 6 | ### 目录结构 7 | 8 | * my-docs: 综合文档 9 | 10 | * my-test: 用于代码分析的测试用例 11 | 12 | * src: HSQLDB数据库的最新源代码,在源代码中附加了便于分析理解代码的注释 13 | 14 | 15 | ### 把代码导入Eclipse 16 | 17 | * 运行 mvn eclipse:eclipse 生成Eclipse项目,打开Eclipse,选择File -> Import -> Existing Projects into Workspace 18 | 19 | 20 | ### 运行或调试HSQLDB 21 | 22 | * 右击 /hsqldb-research/my-test/java/my/test/HsqldbServerStart.java 文件,点Run As或Debug As -> Java Application 23 | 24 | * 如果出现"Startup sequence completed"这样的提示就说明启动成功啦 25 | 26 | 27 | ### 测试 28 | 29 | * my.test 包中的类几乎都可直接运行 30 | -------------------------------------------------------------------------------- /bin/memorydbmanager.html: -------------------------------------------------------------------------------- 1 | HyperSQL Database applet 2 | 3 |

In-Memory Applet: Database Manager

4 | 5 | 6 | 7 |

8 | Connect to the default memory database with the connection dialogue. Then use the menu and select 9 | Option -> Insert Test Data to populate the sample database. 10 | 11 | The menu item Recent has some SELECT statements to try. You can enter your own data and use your own queries. 12 | 13 |

14 | The database is running as an applet inside the web browser and all data is kept in memory.
15 | The data will be lost if the browser window is closed.
16 |

17 | If the database window does not show, there may be a setup problem.

18 | This demo requires Java 1.6 and has been tested with Mozilla Firefox. 19 |

-------------------------------------------------------------------------------- /bin/runManager.bat: -------------------------------------------------------------------------------- 1 | cd ..\data 2 | @java -classpath ..\lib\hsqldb.jar org.hsqldb.util.DatabaseManager %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /bin/runManagerSwing.bat: -------------------------------------------------------------------------------- 1 | cd ..\data 2 | @java -classpath ..\lib\hsqldb.jar org.hsqldb.util.DatabaseManagerSwing %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /bin/runServer.bat: -------------------------------------------------------------------------------- 1 | cd ..\data 2 | @java -classpath ../lib/hsqldb.jar org.hsqldb.server.Server %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /bin/runUtil.bat: -------------------------------------------------------------------------------- 1 | cd ..\data 2 | @java -classpath ..\lib\hsqldb.jar org.hsqldb.util.%1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /bin/runWebServer.bat: -------------------------------------------------------------------------------- 1 | cd ..\data 2 | @java -classpath ..\lib\hsqldb.jar org.hsqldb.server.WebServer %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /build/antivy-setup.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | An Ant target that you have invoked, directly or indirectly, has been changed 11 | to reply upon Gradle. 12 | Please rerun your Ant command as a Gradle command, using 'gradlew' in place of 13 | 'ant'. 14 | 15 | 16 | -------------------------------------------------------------------------------- /build/build.hsqldb.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | ant clean hsqldb 3 | -------------------------------------------------------------------------------- /build/build.hsqldbtest.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | ant clean hsqldb hsqldbtest -------------------------------------------------------------------------------- /build/build.javadoc.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | call ant clean javadoc 3 | 4 | pause -------------------------------------------------------------------------------- /build/build.sqltool.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | ant clean sqltool -------------------------------------------------------------------------------- /build/build.test.suite.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | ant clean hsqldb preprocessor sqltool 3 | ant -f test.xml clean.test.suite make.test.suite -------------------------------------------------------------------------------- /build/clean.test.suite.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | ant -f test.xml clean.test.suite -------------------------------------------------------------------------------- /build/dbuInstallSheetsWrapper.groovy: -------------------------------------------------------------------------------- 1 | retVal = DocBookUtil.installStyleSheets(params[0], params[1]) 2 | -------------------------------------------------------------------------------- /build/gradle-gui: -------------------------------------------------------------------------------- 1 | #!/bin/bash -p 2 | 3 | # $Id$ 4 | # Distribution is permitted under the terms of the HSQLDB license. 5 | # (c) 2011 The HSQL Development Group 6 | 7 | # This script automatically 'cd's to directory .../testrun/sqltool in which 8 | # it resides, so that it may be safely executed from desktop managers, etc. 9 | # The main work script, "runtests.groovy" does not have this limitation. 10 | # 11 | # author: Blaine Simpson of the HSQL Development Group 12 | 13 | case "$0" in 14 | /*) SCRIPTDIR="${0%/*}";; */*) SCRIPTDIR="$PWD/${0%/*}";; *) SCRIPTDIR="$PWD";; 15 | esac 16 | case "$SCRIPTDIR" in *?/.) SCRIPTDIR="${SCRIPTDIR%/.}"; esac 17 | 18 | cd "$SCRIPTDIR" 19 | 20 | # If there is no settings file in place, start user with our customized one: 21 | [ -e gradle-app.setting ] || cp gui-initial.setting gradle-app.setting 22 | 23 | # Change JVM settings here: 24 | exec ./gradlew --gui "$@" & 25 | -------------------------------------------------------------------------------- /build/gradle-ivyxml-plugin-0.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/build/gradle-ivyxml-plugin-0.3.2.jar -------------------------------------------------------------------------------- /build/gradle-javaPropFile-plugin-0.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/build/gradle-javaPropFile-plugin-0.6.0.jar -------------------------------------------------------------------------------- /build/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/build/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /build/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 20 11:26:12 EDT 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip 7 | -------------------------------------------------------------------------------- /build/gui-initial.setting: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /build/gui-welcome.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Please stand by as Gradle starts up... 10 | 11 | 12 | 13 | This window will remain after it's started. 14 | If it annoys you, please minimize it. (Do not close it!) 15 | 16 | 17 | -------------------------------------------------------------------------------- /build/hsqldb.bnd: -------------------------------------------------------------------------------- 1 | # File for use by 'bnd' utility for generating OSGi Bundle descriptions. 2 | # http://www.aqute.biz/Code/Bnd 3 | 4 | Bundle-Version: ${hsqldb.version} 5 | Build-Vendor: ${build.vendor} 6 | Bundle-Description: ${build.description} 7 | Bundle-Name: ${hsqldb.title} 8 | Bundle-SymbolicName: org.hsqldb.hsqldb 9 | -------------------------------------------------------------------------------- /build/ivysettings-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /build/jdkcodeswitch.list: -------------------------------------------------------------------------------- 1 | # Files listed here will be code-switched 2 | # This eliminates the need for CodeSwitcher to scan all source files. 3 | # Version 2.5.0 4 | 5 | org/hsqldb/FunctionCustom.java 6 | org/hsqldb/jdbc/JDBCCallableStatement.java 7 | org/hsqldb/jdbc/JDBCDatabaseMetaData.java 8 | org/hsqldb/jdbc/JDBCDriver.java 9 | org/hsqldb/jdbc/JDBCPreparedStatement.java 10 | org/hsqldb/jdbc/JDBCResultSet.java 11 | org/hsqldb/jdbc/JDBCStatement.java 12 | org/hsqldb/persist/HsqlDatabaseProperties.java 13 | org/hsqldb/types/CharacterType.java 14 | org/hsqldb/types/DateTimeType.java 15 | org/hsqldb/types/IntervalType.java 16 | -------------------------------------------------------------------------------- /build/rng-catalog-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /build/run.test.suite.cmd: -------------------------------------------------------------------------------- 1 | call setenv.cmd 2 | ant -f test.xml run.test.suite -------------------------------------------------------------------------------- /build/setenv.cmd: -------------------------------------------------------------------------------- 1 | REM basic environment setup 2 | REM change as needed 3 | 4 | set JAVA_HOME=C:\Program Files\Java\jdk7 5 | set ANT_HOME=C:\java\lib\ant 6 | set ANT_OPTS=-Xmx512m 7 | set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH% -------------------------------------------------------------------------------- /build/settings.gradle: -------------------------------------------------------------------------------- 1 | //According to Adam Murdoch at 2 | // http://gradle.1045684.n5.nabble.com/Changing-project-name-within-a-build-script-td3321614.html 3 | //"For the Gradle 1.0 release, we plan to merge the settings.gradle script into 4 | // the build script". 5 | rootProject.name = 'hsqldb' 6 | 7 | // Following work-around needed when use -b switch to Gradle, per 8 | // http://forums.gradle.org/gradle/topics/how_change_project_name_when_using_non_build_gradle_build_file 9 | if (startParameter.buildFile) 10 | rootProject.buildFileName = startParameter.buildFile.name 11 | -------------------------------------------------------------------------------- /build/test.dbmd.convert.properties: -------------------------------------------------------------------------------- 1 | ## Note: 2 | ## 3 | ## Most test.dbmd.convert properties have been moved to /org/hsqldb/resources 4 | ## under the test source folder and are now read using the bundle handler facility. 5 | ## 6 | ## System properties now take precedence, so you can use this file 7 | ## to override the values in the default test.dbmd.convert properties file. -------------------------------------------------------------------------------- /build/test.properties: -------------------------------------------------------------------------------- 1 | ## Note: 2 | ## 3 | ## Most test properties have been moved to /org/hsqldb/resources 4 | ## under the test source folder and are now read using the bundle handler facility. 5 | ## 6 | ## System properties now take precedence, so you can use this file 7 | ## to override the values in the default test.properties file. -------------------------------------------------------------------------------- /doc-src/apidocs/hsqldbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/apidocs/hsqldbs.png -------------------------------------------------------------------------------- /doc-src/branding-frag.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | -------------------------------------------------------------------------------- /doc-src/entities/global.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %dummy33; 7 | 8 | 9 | 12 | 13 | 14 | 15 | %dummy31; 18 | 27 | -------------------------------------------------------------------------------- /doc-src/entities/validation_only.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc-src/guide/dsndef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/guide/dsndef.png -------------------------------------------------------------------------------- /doc-src/guide/dsnoptions1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/guide/dsnoptions1.png -------------------------------------------------------------------------------- /doc-src/guide/dsnoptions2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/guide/dsnoptions2.png -------------------------------------------------------------------------------- /doc-src/guide/eclipse-gradle-cfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/guide/eclipse-gradle-cfg.png -------------------------------------------------------------------------------- /doc-src/guide/eclipse-gradle-invoke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/guide/eclipse-gradle-invoke.png -------------------------------------------------------------------------------- /doc-src/guide/gradle-gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/guide/gradle-gui.png -------------------------------------------------------------------------------- /doc-src/hsqldb_lic.txt: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2019, The HSQL Development Group 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * Neither the name of the HSQL Development Group nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | 32 | -------------------------------------------------------------------------------- /doc-src/images/db/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/images/db/home.png -------------------------------------------------------------------------------- /doc-src/images/db/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/images/db/next.png -------------------------------------------------------------------------------- /doc-src/images/db/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/images/db/prev.png -------------------------------------------------------------------------------- /doc-src/images/db/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/images/db/up.png -------------------------------------------------------------------------------- /doc-src/images/hypersql_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/images/hypersql_logo.png -------------------------------------------------------------------------------- /doc-src/images/hypersql_logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/images/hypersql_logo2.png -------------------------------------------------------------------------------- /doc-src/readme-docauthors.txt: -------------------------------------------------------------------------------- 1 | $Id$ 2 | 3 | BUILDING 4 | 5 | You need JDK 1.5 or later and Ant 1.7 or later. 6 | 7 | Run "ant gen-docs" from the build subdirectory. 8 | Error messages should be self-explanatory. 9 | 10 | 11 | SYSTEM 12 | 13 | See http://pub.admc.com/howtos/ant-docbook-howto/system-chapt.html#system-features-sect and 14 | http://pub.admc.com/howtos/ant-docbook-howto/tips-app.html for 15 | important tips. This HOWTO document explains the build system used here. 16 | 17 | 18 | EDITING 19 | 20 | Use DocBook v. 5 syntax in your DocBook source XML files. 21 | 22 | Because of the amount of extra infrastructure needed for DocBook olinking, 23 | we are not supporting direct inter-document linking. If you want to refer 24 | from one DocBook document to content in another one, then add a link to 25 | the canonical document (like using a &distro_bseurl;/guide/index.html link) 26 | and just describe the location referred to. 27 | 28 | Top-level DocBook source files for individual DocBook documents reside at 29 | doc-src/X/X.xml. Other files may be xincluded into these files, and lots of 30 | other resources are referenced or pulled in from under doc-src. 31 | 32 | Please use the product name HyperSQL in major titles. Where introducing 33 | HyperSQL, use a subtitle like "aka HSQLDB". 34 | In the text, use "HyperSQL" as the product name. 35 | In filepaths and package names you code as required for the filepath or package 36 | name, of course. 37 | 38 | Don't capitalize words or phrases to emphasize them (including in 39 | section titles or headings). 40 | If you want to emphasize something a certain way, then use a DocBook emphasis 41 | role, and leave the presentation decisions to the style sheets. 42 | It is very easy to set a CSS style to capitalize headings if you want them to 43 | appear that way. 44 | -------------------------------------------------------------------------------- /doc-src/readme-template.txt: -------------------------------------------------------------------------------- 1 | Readme File 2 | ${timestamp} 3 | This package contains HyperSQL v. ${hsqldb.version} 4 | 5 | HyperSQL Database is a relational database management system and a set of tools 6 | written in Java. 7 | HyperSQL is also known as HSQLDB. 8 | 9 | The file "index.html" explains the contents of this distribution and has 10 | links to documentation and support resources. 11 | -------------------------------------------------------------------------------- /doc-src/util-guide/entities/versions.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /doc-src/util-guide/html-report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/util-guide/html-report.png -------------------------------------------------------------------------------- /doc-src/util-guide/rejreport-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/doc-src/util-guide/rejreport-sample.png -------------------------------------------------------------------------------- /doc-src/verbatim/sample/acl.txt: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | # Sample HyperSQL Network Listener ACL file. 4 | # Specify "allow" and "deny" rules 5 | # For address specifications, individual addresses, host names, and 6 | # network addresses with /bit suffix are allowed, but read the caveat about 7 | # host names below, under the sample "localhost" rule. 8 | 9 | # Blank lines ignored. 10 | # Lines with # as the first non-whitespace character are ignored. 11 | 12 | 13 | allow 2001:db8::/32 14 | # Allow this 32-bit ipv4 subnet 15 | 16 | allow localhost 17 | # You should use numerical addresses in ACL files, unless you are certain that 18 | # the name will always be known to your network address resolution system 19 | # (assume that you will lose Internet connectivity at some time). 20 | # With a default name resolution setup on UNIX, you are safe to use names 21 | # defined in your /etc/hosts file. 22 | 23 | deny 192.168.101.253 24 | # Deny a single IP address. 25 | # In our example, 192.168.101.0/24 is our local, organizational network. 26 | # 192.168.101.253 is the IP address of our Intern's PC. 27 | # The Intern does not have permission to access our databases directly. 28 | 29 | allow 192.168.101.0/24 30 | 31 | # Any ipv4 or ipv6 candidate address not matched above will be denied 32 | -------------------------------------------------------------------------------- /doc-src/verbatim/sample/dsv-sample.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Imports delimiter-separated-values, and generates an output 5 | * reject .dsv file, and a reject report. 6 | * 7 | * To execute, set up a SqlTool database urlid (see User Guide if you don't 8 | * know how to do that); then (from this directory) execute this script like 9 | * 10 | * java ../lib/hsqldb.jar mem dsv-sample.sql 11 | * 12 | * (replace "mem" with your urlid). 13 | */ 14 | 15 | CREATE TABLE sampletable(i INT, d DATE NOT NULL, b BOOLEAN); 16 | 17 | /* If you dont' set *DSV_TARGET_TABLE, it defaults to the base name of the 18 | .dsv file. */ 19 | * *DSV_TARGET_TABLE = sampletable 20 | 21 | \p WARNING: Some records will be skipped, and some others will be rejected. 22 | \p This is on purpose, so you can work with a reject report. 23 | \p 24 | 25 | /* By default, no reject files are written, and the import will abort upon 26 | * the first error encountered. If you set either of these settings, the 27 | * import will continue to completion if at all possible. */ 28 | * *DSV_REJECT_FILE = ${java.io.tmpdir}/sample-reject.dsv 29 | * *DSV_REJECT_REPORT = ${java.io.tmpdir}/sample-reject.html 30 | \m sample.dsv 31 | 32 | /* Enable this line if you want to display all successfully imported data: 33 | SELECT * FROM sampletable; 34 | */ 35 | 36 | \p 37 | \p See import reject report at '*{*DSV_REJECT_REPORT}'. 38 | -------------------------------------------------------------------------------- /doc-src/verbatim/sample/html-report.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Sample/Template for writing an HTML Report 5 | */ 6 | 7 | -- Populate sample data 8 | create table t (i integer, vc varchar(20)); 9 | insert into t values(1, 'one'); 10 | insert into t values(2, 'two'); 11 | insert into t values(3, 'three'); 12 | insert into t values(4, 'four'); 13 | insert into t values(5, 'five'); 14 | commit; 15 | 16 | 17 | -- IMPORTANT: \o will append by default. If you want to write a new file, 18 | -- it's your responsibility to check that a file of the same name does not 19 | -- already exist (or remove it). 20 | 21 | 22 | -- Follow the following examples to use your own HTML fragment files. 23 | -- * *TOP_HTMLFRAG_FILE = /tmp/top.html 24 | -- * *BOTTOM_HTMLFRAG_FILE = /tmp/bottom.html 25 | 26 | -- The default TOP_HTMLFRAG_FILE has a reference to this PL variable. 27 | * REPORT_TITLE = Blaine's Sample Report 28 | -- The default will also override its CSS style settings with your own if you 29 | -- put them in a file named "overrides.css" in same directory alongside your 30 | -- reports ("report.html" in this example). 31 | -- You can add references to ${system.properties} and *{PL_VARIABLES} in 32 | -- your own custom fragment files too. 33 | 34 | 35 | -- Turn on HTML output mode. 36 | -- Must enable HTML _before_ opening to write top frag. 37 | \h true 38 | \o report.html 39 | \p A message to appear in the Report 40 | SELECT * FROM t; 41 | 42 | -- Close off output just to show that you can go back and forth. 43 | -- A close with '\o' will not write the bottom boilerplate that closes the HTML. 44 | \o 45 | \h false 46 | \p Some non-HTML non-Report output: 47 | SELECT count(*) FROM t; 48 | 49 | \h true 50 | -- Re-open the report 51 | \o report.html 52 | \d t 53 | -- This time close it with 54 | \oc 55 | -------------------------------------------------------------------------------- /doc-src/verbatim/sample/plsql.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * This example is copied from the "Simple Programs in PL/SQL" 5 | * example by Yu-May Chang, Jeff Ullman, Prof. Jennifer Widom at 6 | * the Standord University Database Group's page 7 | * http://www-db.stanford.edu/~ullman/fcdb/oracle/or-plsql.html . 8 | * I have only removed some blank lines (in case somebody wants to 9 | * copy this code interactively-- because you can't use blank 10 | * lines inside of SQL commands in non-raw mode SqlTool when running 11 | * it interactively); and, at the bottom I have replaced the 12 | * client-specific, non-standard command "run;" with SqlTool's 13 | * corresponding command ".;" and added a plain SQL SELECT command 14 | * to show whether the PL/SQL code worked. - Blaine 15 | */ 16 | 17 | CREATE TABLE T1( 18 | e INTEGER, 19 | f INTEGER 20 | ); 21 | 22 | DELETE FROM T1; 23 | 24 | INSERT INTO T1 VALUES(1, 3); 25 | 26 | INSERT INTO T1 VALUES(2, 4); 27 | 28 | /* Above is plain SQL; below is the PL/SQL program. */ 29 | DECLARE 30 | 31 | a NUMBER; 32 | 33 | b NUMBER; 34 | 35 | BEGIN 36 | 37 | SELECT e,f INTO a,b FROM T1 WHERE e>1; 38 | 39 | INSERT INTO T1 VALUES(b,a); 40 | 41 | END; 42 | 43 | .; 44 | /** The statement on the previous line, ".;" is SqlTool specific. 45 | * This command says to save the input up to this point to the 46 | * edit buffer and send it to the database server for execution. 47 | * I added the SELECT statement below to give imm 48 | */ 49 | 50 | /* This should show 3 rows, one containing values 4 and 2 (in this order)...*/ 51 | SELECT * FROM t1; 52 | -------------------------------------------------------------------------------- /doc-src/verbatim/sample/sample.sql: -------------------------------------------------------------------------------- 1 | /* 2 | $Id$ 3 | Exemplifies use of SqlTool. 4 | PCTASK Table creation 5 | */ 6 | 7 | /* Ignore error for these two statements */ 8 | \c true 9 | DROP TABLE pctasklist; 10 | DROP TABLE pctask; 11 | \c false 12 | 13 | \p Creating table pctask 14 | CREATE TABLE pctask ( 15 | id integer identity, 16 | name varchar(40), 17 | description varchar(256), 18 | url varchar(80), 19 | UNIQUE (name) 20 | ); 21 | 22 | \p Creating table pctasklist 23 | CREATE TABLE pctasklist ( 24 | id integer identity, 25 | host varchar(20) not null, 26 | tasksequence int not null, 27 | pctask integer, 28 | assigndate timestamp default current_timestamp, 29 | completedate timestamp, 30 | show boolean default true, 31 | FOREIGN KEY (pctask) REFERENCES pctask, 32 | UNIQUE (host, tasksequence) 33 | ); 34 | 35 | \p Granting privileges 36 | GRANT select ON pctask TO public; 37 | GRANT all ON pctask TO tomcat; 38 | GRANT select ON pctasklist TO public; 39 | GRANT all ON pctasklist TO tomcat; 40 | 41 | \p Inserting test records 42 | INSERT INTO pctask (name, description, url) VALUES ( 43 | 'task one', 'Description for task 1', 'http://cnn.com'); 44 | INSERT INTO pctasklist (host, tasksequence, pctask) VALUES ( 45 | 'admc-masq', 101, (SELECT id FROM pctask WHERE name = 'task one')); 46 | 47 | commit; 48 | -------------------------------------------------------------------------------- /doc-src/verbatim/sample/server.properties: -------------------------------------------------------------------------------- 1 | # Hsqldb Server cfg file. 2 | # See the HyperSQL Network Listeners chapter of the HyperSQL User Guide. 3 | 4 | # Each server.database.X setting defines a database "catalog". 5 | # I.e., an independent set of data. 6 | # Each server.database.X setting corresponds exactly to the jdbc:hsqldb:* 7 | # JDBC URL you would use if you wanted to get a direct (In-Process) 8 | # Connection to the catalog instead of "serving" it. 9 | 10 | server.database.0=file:db0/db0 11 | # I suggest that, for every file: catalog you define, you add the 12 | # connection property "ifexists=true" after the database instance 13 | # is created (which happens simply by starting the Server one time). 14 | # Just append ";ifexists=true" to the file: URL, like so: 15 | # server.database.0=file:db0/db0;ifexists=true 16 | 17 | # server.dbname.0 defaults to "" (i.e. server.dbname.n for n==0), but 18 | # the catalog definition n will be entirely ignored for n > 0 if you do not 19 | # set server.dbname.n. I.e. dbname setting is required for n > 0, though it 20 | # may be set to blank (e.g. "server.dbname.3=") 21 | -------------------------------------------------------------------------------- /doc-src/verbatim/src/org/hsqldb/Trigger.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2019, The HSQL Development Group 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * Neither the name of the HSQL Development Group nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | 32 | package org.hsqldb; 33 | 34 | public interface Trigger extends org.hsqldb.trigger.Trigger {} 35 | -------------------------------------------------------------------------------- /doc-src/verbatim/testrun/sqltool/sqljrt.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests SQL/JRT 5 | */ 6 | 7 | create function dehex(VARCHAR(80), INTEGER) 8 | returns INTEGER 9 | no sql 10 | language java 11 | external name 'CLASSPATH:java.lang.Integer.valueOf' 12 | .; 13 | 14 | CALL dehex('12', 16); 15 | *if (*? != 18) \q SQL/JRT function failed 16 | -------------------------------------------------------------------------------- /doc-src/verbatim/testrun/sqltool/sqlpsm.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests SQL/JRT 5 | */ 6 | 7 | create table customers( 8 | id INTEGER default 0, firstname VARCHAR(50), lastname VARCHAR(50), 9 | entrytime TIMESTAMP); 10 | 11 | create procedure new_customer(firstname varchar(50), lastname varchar(50)) 12 | modifies sql data 13 | insert into customers values ( 14 | default, firstname, lastname, current_timestamp) 15 | .; 16 | 17 | SELECT count(*) FROM customers; 18 | *if (*? != 0) \q SQL/PSM preparation failed 19 | 20 | CALL new_customer('blaine', 'simpson'); 21 | 22 | SELECT count(*) FROM customers; 23 | *if (*? != 1) \q SQL/PSM procedure failed 24 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/ivy-projsetup.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Add Ivy jar file to Ant CLASSPATH. 25 | Copy-and-paste this for any Bourne shell (inc. Bash): 26 | 27 | export ANT_ARGS; ANT_ARGS='-lib ${basedir}/../../build/ivy-2.2.0.jar -noclasspath' 28 | 29 | OR copy-and-paste this for any CMD-like Windows shell: 30 | 31 | SET ANT_ARGS=-lib "${basedir}/../../build/ivy-2.2.0.jar" -noclasspath 32 | 33 | 34 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/ivysettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/jul.properties: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | # As this is a Java .properties file, use ISO-8859-1 encoding for any 4 | # extended characters. 5 | 6 | # See http://java.sun.com/javase/6/docs/technotes/guides/logging/overview.html 7 | # for an overview of the JDK logging system, aka the Java Logging API or 8 | # java.util.logging. 9 | # If you want more, and easier, control, particularly over the format of 10 | # output records, use Log4J instead. 11 | 12 | # This is different from the default logging file provided by HyperSQL. 13 | # Here, we purposefully turn up verbosity of the org.hsqldb.sample classes so 14 | # the user can see what is going in the examples. 15 | 16 | handlers=java.util.logging.ConsoleHandler 17 | .level=WARNING 18 | 19 | java.util.logging.ConsoleHandler.level=INFO 20 | java.util.logging.ConsoleHandler.formatter=org.hsqldb.lib.BasicTextJdkLogFormatter 21 | org.hsqldb.sample.level=INFO 22 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/readme.txt: -------------------------------------------------------------------------------- 1 | $Id$ 2 | 3 | This is the home directory of the extAuthWithSpring sample. 4 | 5 | It uses Spring to declaratively configure external authentication with a 6 | master HyperSQL catalog, or with an LDAP server. 7 | 8 | You will need Ant and a Java JDK installed. To get started, invoke 9 | 10 | ant -Dauthentication.mode=HsqldbSlave 11 | 12 | from this directory to run a JDBC app backed by an application database, with 13 | authentication to the application database through another embedded master 14 | database. Play with the Spring bean files in the resources subdirectory to 15 | switch the application database or the masterdatabase, or anything else. 16 | 17 | To play with a JAAS module, run 18 | 19 | ant -Dauthentication.mode=JAAS 20 | 21 | The file resources/jaas.cfg will be generated the first time that you run 22 | anything with Ant. With mode set to "JAAS", the "demo" application 23 | configuration in jaas.cfg will be used. 24 | 25 | If you have an LDAP server, edit "resources/ldapbeans.xml" to set settings 26 | according to your LDAP server then run ant with the authentication.mode set to 27 | "LDAP". 28 | To help determine and test the settings that will work with your LDAP server, I 29 | recommend that you use the program org.hsqldb.auth.LdapAuthBean. See the 30 | HyperSQL API Spec for org.hsqldb.auth.LdapAuthBean and the sample properties 31 | file for it at "sample/ldap-exerciser.properties" in your HyperSQL distribution. 32 | 33 | As an alternative to LDAP mode, you can use JAAS_LDAP mode. That works very 34 | similarly, but uses Sun's JAAS LDAP module and suffers from its limitations. 35 | It should be easy to figure out how to use by looking over the "sunLdap" 36 | application settings in jaas.cfg, and the Spring bean definitions in 37 | resources/jaasldapbeans.xml. 38 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/resources/beandefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 12 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/resources/jaasbeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/resources/jaasldapbeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/resources/ldapbeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /integration/extAuthWithSpring/resources/slavebeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /integration/jackrabbit/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains access files for Apache Jackrabbit (http://jackrabbit.apache.org/) 2 | 3 | The ddl file for jackrabbit version 2.x is located at: 4 | 5 | resources/org/apache/jackrabbit/core/persistence/bundle/hsqldb.ddl 6 | 7 | This ddl file can be used with the default BundleDbPersistenceManager 8 | 9 | Copy the ddl file to the same directory in your Jackrabbit setup, alongside the existing 10 | ddl files. For example jackrabbit-standalone-2.2.4/org/apache/jackrabbit/core/persistence/bundle 11 | 12 | A sample configuration is given below. The DDL table definitions use BLOBs, which 13 | are stored on disk. 14 | 15 | If you are storing no more than several thousand objects, the non-blob fields can be stored in 16 | memory for quicker access with hsqldb.default_table_type=memory. See the hsqldb documentation 17 | at http://hsqldb.org/doc/2.0/ for different connection URL and other properties that can be used. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | A ddl file for older versions of Jackrabbit is also included in the ...core/persistence/db directory. 28 | 29 | All files are modified copies of existing Jackrabbit sources. 30 | 31 | 32 | -------------------------------------------------------------------------------- /integration/jackrabbit/resources/org/apache/jackrabbit/core/journal/hsqldb.ddl: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | create table ${schemaObjectPrefix}JOURNAL (REVISION_ID BIGINT NOT NULL, JOURNAL_ID varchar(255), PRODUCER_ID varchar(255), REVISION_DATA blob) 16 | create unique index ${schemaObjectPrefix}JOURNAL_IDX on ${schemaObjectPrefix}JOURNAL (REVISION_ID) 17 | create table ${schemaObjectPrefix}GLOBAL_REVISION (REVISION_ID BIGINT NOT NULL) 18 | create unique index ${schemaObjectPrefix}GLOBAL_REVISION_IDX on ${schemaObjectPrefix}GLOBAL_REVISION (REVISION_ID) 19 | create table ${schemaObjectPrefix}LOCAL_REVISIONS (JOURNAL_ID varchar(255) NOT NULL, REVISION_ID BIGINT NOT NULL) 20 | 21 | # Inserting the one and only revision counter record now helps avoiding race conditions 22 | insert into ${schemaObjectPrefix}GLOBAL_REVISION VALUES(0) 23 | -------------------------------------------------------------------------------- /integration/jackrabbit/resources/org/apache/jackrabbit/core/persistence/bundle/hsqldb.ddl: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Bundle persistence DDL script for the HSQLDB database engine (http://www.hsqldb.org) 17 | # 18 | create table ${schemaObjectPrefix}BUNDLE (NODE_ID binary(16) primary key, BUNDLE_DATA blob(2G) not null)) 19 | create table ${schemaObjectPrefix}REFS (NODE_ID binary(16) PRIMARY KEY primary key, REFS_DATA blob(2G) not null)) 20 | create table ${schemaObjectPrefix}BINVAL (BINVAL_ID char(64) PRIMARY KEY, BINVAL_DATA blob(2G) not null) 21 | create table ${schemaObjectPrefix}NAMES (ID INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, NAME varchar(255) not null) 22 | -------------------------------------------------------------------------------- /integration/jackrabbit/resources/org/apache/jackrabbit/core/persistence/db/hsqldb.ddl: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # DDL script for the HSQLDB database engine (http://www.hsqldb.org) 17 | # 18 | create table ${schemaObjectPrefix}NODE (NODE_ID char(36) primary key, NODE_DATA blob not null) 19 | create table ${schemaObjectPrefix}PROP (PROP_ID varchar(1024) primary key, PROP_DATA blob not null) 20 | create table ${schemaObjectPrefix}REFS (NODE_ID char(36) primary key, REFS_DATA blob not null) 21 | create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(1024) primary key, BINVAL_DATA blob not null) 22 | -------------------------------------------------------------------------------- /integration/readme.txt: -------------------------------------------------------------------------------- 1 | $Id$ 2 | 3 | Each subdirectory of this directory is a home directory to a sample integration 4 | application. 5 | 6 | See the "readme.txt" file in each subdirectory to see the purpose of that 7 | particular sample. 8 | -------------------------------------------------------------------------------- /lib/servlet-2_3-fcs-classfiles.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/lib/servlet-2_3-fcs-classfiles.zip -------------------------------------------------------------------------------- /my-test/java/my/test/HsqldbServerStart.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package my.test; 19 | 20 | public class HsqldbServerStart { 21 | 22 | public static void main(String[] args) { 23 | args = new String[] { "--help" }; 24 | 25 | args = new String[] { "--props", "my-test/resources/server.properties" }; 26 | org.hsqldb.server.Server.main(args); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /my-test/resources/META-INF/services/java.sql.Driver: -------------------------------------------------------------------------------- 1 | org.hsqldb.jdbc.JDBCDriver -------------------------------------------------------------------------------- /my-test/resources/server.properties: -------------------------------------------------------------------------------- 1 | # Hsqldb Server cfg file. 2 | # See the HyperSQL Network Listeners chapter of the HyperSQL User Guide. 3 | 4 | # Each server.database.X setting defines a database "catalog". 5 | # I.e., an independent set of data. 6 | # Each server.database.X setting corresponds exactly to the jdbc:hsqldb:* 7 | # JDBC URL you would use if you wanted to get a direct (In-Process) 8 | # Connection to the catalog instead of "serving" it. 9 | 10 | server.database.0=file:target/mytest/db0 11 | # I suggest that, for every file: catalog you define, you add the 12 | # connection property "ifexists=true" after the database instance 13 | # is created (which happens simply by starting the Server one time). 14 | # Just append ";ifexists=true" to the file: URL, like so: 15 | # server.database.0=file:db0/db0;ifexists=true 16 | 17 | # server.dbname.0 defaults to "" (i.e. server.dbname.n for n==0), but 18 | # the catalog definition n will be entirely ignored for n > 0 if you do not 19 | # set server.dbname.n. I.e. dbname setting is required for n > 0, though it 20 | # may be set to blank (e.g. "server.dbname.3=") 21 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | Readme File 2 | 2019/09/02-19:10:29 3 | This package contains HyperSQL v. 2.5.1 4 | 5 | HyperSQL Database is a relational database management system and a set of tools 6 | written in Java. 7 | HyperSQL is also known as HSQLDB. 8 | 9 | The file "index.html" explains the contents of this distribution and has 10 | links to documentation and support resources. 11 | -------------------------------------------------------------------------------- /sample/StartupParameters.plist: -------------------------------------------------------------------------------- 1 | /* 2 | $Id$ 3 | Startup Item parameter file that works on at least one Mac OS X system. 4 | 5 | I don't know which of the "Uses" services are available on all Mac's. 6 | I just know that my system has them, and this list causes HSQLDB 7 | to start late enough without resorting to "Latest" (which could cause 8 | problems for people who also start up apps that use HSQLDB). 9 | */ 10 | { 11 | Description = "HSQLDB Database Server"; 12 | Provides = ("Hsqldb"); 13 | Requires = ("Resolver"); 14 | Uses = ("Disks", "Network", "Core Services", "TIM", "NetInfo", "Resolver"); 15 | Messages = 16 | { 17 | start = "Starting Hsqldb"; 18 | stop = "Stopping Hsqldb"; 19 | restart = "Restarting Hsqldb"; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /sample/acl.txt: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | # Sample HyperSQL Network Listener ACL file. 4 | # Specify "allow" and "deny" rules 5 | # For address specifications, individual addresses, host names, and 6 | # network addresses with /bit suffix are allowed, but read the caveat about 7 | # host names below, under the sample "localhost" rule. 8 | 9 | # Blank lines ignored. 10 | # Lines with # as the first non-whitespace character are ignored. 11 | 12 | 13 | allow 2001:db8::/32 14 | # Allow this 32-bit ipv4 subnet 15 | 16 | allow localhost 17 | # You should use numerical addresses in ACL files, unless you are certain that 18 | # the name will always be known to your network address resolution system 19 | # (assume that you will lose Internet connectivity at some time). 20 | # With a default name resolution setup on UNIX, you are safe to use names 21 | # defined in your /etc/hosts file. 22 | 23 | deny 192.168.101.253 24 | # Deny a single IP address. 25 | # In our example, 192.168.101.0/24 is our local, organizational network. 26 | # 192.168.101.253 is the IP address of our Intern's PC. 27 | # The Intern does not have permission to access our databases directly. 28 | 29 | allow 192.168.101.0/24 30 | 31 | # Any ipv4 or ipv6 candidate address not matched above will be denied 32 | -------------------------------------------------------------------------------- /sample/dsv-sample.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Imports delimiter-separated-values, and generates an output 5 | * reject .dsv file, and a reject report. 6 | * 7 | * To execute, set up a SqlTool database urlid (see User Guide if you don't 8 | * know how to do that); then (from this directory) execute this script like 9 | * 10 | * java ../lib/hsqldb.jar mem dsv-sample.sql 11 | * 12 | * (replace "mem" with your urlid). 13 | */ 14 | 15 | CREATE TABLE sampletable(i INT, d DATE NOT NULL, b BOOLEAN); 16 | 17 | /* If you dont' set *DSV_TARGET_TABLE, it defaults to the base name of the 18 | .dsv file. */ 19 | * *DSV_TARGET_TABLE = sampletable 20 | 21 | \p WARNING: Some records will be skipped, and some others will be rejected. 22 | \p This is on purpose, so you can work with a reject report. 23 | \p 24 | 25 | /* By default, no reject files are written, and the import will abort upon 26 | * the first error encountered. If you set either of these settings, the 27 | * import will continue to completion if at all possible. */ 28 | * *DSV_REJECT_FILE = ${java.io.tmpdir}/sample-reject.dsv 29 | * *DSV_REJECT_REPORT = ${java.io.tmpdir}/sample-reject.html 30 | \m sample.dsv 31 | 32 | /* Enable this line if you want to display all successfully imported data: 33 | SELECT * FROM sampletable; 34 | */ 35 | 36 | \p 37 | \p See import reject report at '*{*DSV_REJECT_REPORT}'. 38 | -------------------------------------------------------------------------------- /sample/hsqldb.service: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | # This file is a systemd init script wrapper for leading-edge UNIXes. 4 | # Copy $HSQLDB_HOME/.../sample/hsqldb.cfg to /etc/hsqldb.conf and edit it. 5 | # Tend to the "TODO" note below. 6 | # Our init script will fail unless your .rc file is protected something like: 7 | # chmod 0600 /path/to/sqltool.rc 8 | # 9 | # To activate this file, run: systemd daemon-reload 10 | # To enable to execute upon system bootups/shutdowns (the ultimate purpose), run: 11 | # systemctl enable hsqldb 12 | # 13 | # -- Blaine (blaine dot simpson at admc dot com) 14 | 15 | [Unit] 16 | Description=HyperSQL Database Server 17 | After=socket.service 18 | 19 | [Service] 20 | # TODO! Change these paths to point to the absolute path of the "hsqldb.init" 21 | # script in your HyperSQL distribution: 22 | ExecStart=/local/hsqldb-2.3.4/sample/hsqldb.init start 23 | ExecReload=/local/hsqldb-2.3.4/sample/hsqldb.init restart 24 | ExecStop=/local/hsqldb-2.3.4/sample/hsqldb.init stop 25 | KillMode=process 26 | #Restart=always Don't silently restart and mask real problems 27 | PIDFile=/var/run/hsqldb.pid 28 | #User=... We manage user from file /etc/hsqldb.conf 29 | #WorkingDirectory=... No dependency on $PWD 30 | Type=forking 31 | TimeoutStartSec=10 32 | 33 | [Install] 34 | WantedBy=multi-user.target 35 | -------------------------------------------------------------------------------- /sample/html-report.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Sample/Template for writing an HTML Report 5 | */ 6 | 7 | -- Populate sample data 8 | create table t (i integer, vc varchar(20)); 9 | insert into t values(1, 'one'); 10 | insert into t values(2, 'two'); 11 | insert into t values(3, 'three'); 12 | insert into t values(4, 'four'); 13 | insert into t values(5, 'five'); 14 | commit; 15 | 16 | 17 | -- IMPORTANT: \o will append by default. If you want to write a new file, 18 | -- it's your responsibility to check that a file of the same name does not 19 | -- already exist (or remove it). 20 | 21 | 22 | -- Follow the following examples to use your own HTML fragment files. 23 | -- * *TOP_HTMLFRAG_FILE = /tmp/top.html 24 | -- * *BOTTOM_HTMLFRAG_FILE = /tmp/bottom.html 25 | 26 | -- The default TOP_HTMLFRAG_FILE has a reference to this PL variable. 27 | * REPORT_TITLE = Blaine's Sample Report 28 | -- The default will also override its CSS style settings with your own if you 29 | -- put them in a file named "overrides.css" in same directory alongside your 30 | -- reports ("report.html" in this example). 31 | -- You can add references to ${system.properties} and *{PL_VARIABLES} in 32 | -- your own custom fragment files too. 33 | 34 | 35 | -- Turn on HTML output mode. 36 | -- Must enable HTML _before_ opening to write top frag. 37 | \h true 38 | \o report.html 39 | \p A message to appear in the Report 40 | SELECT * FROM t; 41 | 42 | -- Close off output just to show that you can go back and forth. 43 | -- A close with '\o' will not write the bottom boilerplate that closes the HTML. 44 | \o 45 | \h false 46 | \p Some non-HTML non-Report output: 47 | SELECT count(*) FROM t; 48 | 49 | \h true 50 | -- Re-open the report 51 | \o report.html 52 | \d t 53 | -- This time close it with 54 | \oc 55 | -------------------------------------------------------------------------------- /sample/j-sample.sql: -------------------------------------------------------------------------------- 1 | /* 2 | $Id$ 3 | Exemplifies use of SqlTool's \j command to specify the JDBC connection 4 | parameters right in the SQL file. 5 | 6 | Invoke like this: 7 | 8 | java -jar .../sqltool.jar - .../j-sample.sql 9 | 10 | (give the file paths to wherever these two files reside). 11 | Or start up SqlTool like this: 12 | 13 | java -jar .../sqltool.jar 14 | 15 | and then execute this script like 16 | 17 | \i .../j-sample.sql 18 | */ 19 | 20 | -- Abort this script when errors occur. 21 | -- That's the default if the script is invoked from command-line, but not if 22 | -- invoked by \i. 23 | \c false 24 | 25 | -- Note the new feature in HyperSQL 2, whereby you can set an SA password 26 | -- by just specifying that as the password for the very first connection to 27 | -- that database 28 | \j SA fred jdbc:hsqldb:mem:fred 29 | -- FORMAT: \j 30 | 31 | \p You have conkected successfully 32 | \p 33 | 34 | CREATE TABLE t(i BIGINT, vc VARCHAR(20)); 35 | INSERT INTO t VALUES(1, 'one'); 36 | INSERT INTO t VALUES(2, 'two'); 37 | 38 | SELECT * FROM t; 39 | -------------------------------------------------------------------------------- /sample/load_binding_lu.sql: -------------------------------------------------------------------------------- 1 | /* 2 | $Id$ 3 | Load BINDING Lookup Text Table 4 | */ 5 | 6 | \p Creating table BINDING_TMPTXT 7 | CREATE TEMP TEXT TABLE binding_tmptxt ( 8 | id integer, 9 | name varchar(12) 10 | ); 11 | 12 | \p Setting text file source 13 | SET TABLE binding_tmptxt SOURCE "binding_lu.ttbl;ignore_first=true;fs=|"; 14 | 15 | \p rows in binding_tmptxt: 16 | select count(*) from binding_tmptxt; 17 | \p PRE rows in binding_lu: 18 | select count(*) from binding_lu; 19 | 20 | INSERT INTO binding_lu ( 21 | id, 22 | name 23 | ) SELECT 24 | id, 25 | name 26 | FROM BINDING_TMPTXT; 27 | 28 | commit; 29 | 30 | \p POST rows in binding_lu: 31 | select count(*) from binding_lu; 32 | -------------------------------------------------------------------------------- /sample/nullempty.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * This sample shows differences between null and empty strings, 5 | * and ? var vs. _/~ variables. 6 | */ 7 | 8 | \p At startup ? is equal to empty string. See between A and B: A*{?}B 9 | * if (A*{?}B == AB) \p ? is the empty string 10 | 11 | CREATE TABLE t(i INTEGER, vc VARCHAR(20)); 12 | INSERT INTO t VALUES(1, 'one'); 13 | INSERT INTO t VALUES(2, 'two'); 14 | * res ~ 15 | SELECT * FROM t; 16 | \p *{?} 17 | \p *{res} 18 | * listvalues ? res 19 | 20 | INSERT INTO t VALUES (3, null); 21 | *res ~ 22 | SELECT vc FROM t WHERE i = 3; 23 | \p *{?} 24 | * if (*res == **NULL) \p res really is null 25 | * listvalues ? res 26 | 27 | -- This will prevent SqlTool from aborting when we run a bad SQL statement: 28 | \c true 29 | *res ~ 30 | SELECT hocus FROM pocus; 31 | * if (*? == **NULL) \p ? really is null 32 | * if (*res == **NULL) \p res really is null 33 | * listvalues ? res 34 | -------------------------------------------------------------------------------- /sample/plsql.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * This example is copied from the "Simple Programs in PL/SQL" 5 | * example by Yu-May Chang, Jeff Ullman, Prof. Jennifer Widom at 6 | * the Standord University Database Group's page 7 | * http://www-db.stanford.edu/~ullman/fcdb/oracle/or-plsql.html . 8 | * I have only removed some blank lines (in case somebody wants to 9 | * copy this code interactively-- because you can't use blank 10 | * lines inside of SQL commands in non-raw mode SqlTool when running 11 | * it interactively); and, at the bottom I have replaced the 12 | * client-specific, non-standard command "run;" with SqlTool's 13 | * corresponding command ".;" and added a plain SQL SELECT command 14 | * to show whether the PL/SQL code worked. - Blaine 15 | */ 16 | 17 | CREATE TABLE T1( 18 | e INTEGER, 19 | f INTEGER 20 | ); 21 | 22 | DELETE FROM T1; 23 | 24 | INSERT INTO T1 VALUES(1, 3); 25 | 26 | INSERT INTO T1 VALUES(2, 4); 27 | 28 | /* Above is plain SQL; below is the PL/SQL program. */ 29 | DECLARE 30 | 31 | a NUMBER; 32 | 33 | b NUMBER; 34 | 35 | BEGIN 36 | 37 | SELECT e,f INTO a,b FROM T1 WHERE e>1; 38 | 39 | INSERT INTO T1 VALUES(b,a); 40 | 41 | END; 42 | 43 | .; 44 | /** The statement on the previous line, ".;" is SqlTool specific. 45 | * This command says to save the input up to this point to the 46 | * edit buffer and send it to the database server for execution. 47 | * I added the SELECT statement below to give imm 48 | */ 49 | 50 | /* This should show 3 rows, one containing values 4 and 2 (in this order)...*/ 51 | SELECT * FROM t1; 52 | -------------------------------------------------------------------------------- /sample/sample.dsv: -------------------------------------------------------------------------------- 1 | # Comment lines like this are permitted by default, as are 2 | 3 | # blank lines. Header line follows: 4 | i|d|b 5 | 6 | # Two good rows: 7 | 1|2007-01-02|true 8 | 2|2007-01-03|false 9 | 10 | # This should cause a parse error: 11 | 3|not a date|true 12 | 13 | # This should cause a database error: 14 | 4||true 15 | 16 | 5|2007-01-04|false 17 | -------------------------------------------------------------------------------- /sample/sample.sql: -------------------------------------------------------------------------------- 1 | /* 2 | $Id$ 3 | Exemplifies use of SqlTool. 4 | PCTASK Table creation 5 | */ 6 | 7 | /* Ignore error for these two statements */ 8 | \c true 9 | DROP TABLE pctasklist; 10 | DROP TABLE pctask; 11 | \c false 12 | 13 | \p Creating table pctask 14 | CREATE TABLE pctask ( 15 | id integer identity, 16 | name varchar(40), 17 | description varchar(256), 18 | url varchar(80), 19 | UNIQUE (name) 20 | ); 21 | 22 | \p Creating table pctasklist 23 | CREATE TABLE pctasklist ( 24 | id integer identity, 25 | host varchar(20) not null, 26 | tasksequence int not null, 27 | pctask integer, 28 | assigndate timestamp default current_timestamp, 29 | completedate timestamp, 30 | show boolean default true, 31 | FOREIGN KEY (pctask) REFERENCES pctask, 32 | UNIQUE (host, tasksequence) 33 | ); 34 | 35 | \p Granting privileges 36 | GRANT select ON pctask TO public; 37 | GRANT all ON pctask TO tomcat; 38 | GRANT select ON pctasklist TO public; 39 | GRANT all ON pctasklist TO tomcat; 40 | 41 | \p Inserting test records 42 | INSERT INTO pctask (name, description, url) VALUES ( 43 | 'task one', 'Description for task 1', 'http://cnn.com'); 44 | INSERT INTO pctasklist (host, tasksequence, pctask) VALUES ( 45 | 'admc-masq', 101, (SELECT id FROM pctask WHERE name = 'task one')); 46 | 47 | commit; 48 | -------------------------------------------------------------------------------- /sample/server.properties: -------------------------------------------------------------------------------- 1 | # Hsqldb Server cfg file. 2 | # See the HyperSQL Network Listeners chapter of the HyperSQL User Guide. 3 | 4 | # Each server.database.X setting defines a database "catalog". 5 | # I.e., an independent set of data. 6 | # Each server.database.X setting corresponds exactly to the jdbc:hsqldb:* 7 | # JDBC URL you would use if you wanted to get a direct (In-Process) 8 | # Connection to the catalog instead of "serving" it. 9 | 10 | server.database.0=file:db0/db0 11 | # I suggest that, for every file: catalog you define, you add the 12 | # connection property "ifexists=true" after the database instance 13 | # is created (which happens simply by starting the Server one time). 14 | # Just append ";ifexists=true" to the file: URL, like so: 15 | # server.database.0=file:db0/db0;ifexists=true 16 | 17 | # server.dbname.0 defaults to "" (i.e. server.dbname.n for n==0), but 18 | # the catalog definition n will be entirely ignored for n > 0 if you do not 19 | # set server.dbname.n. I.e. dbname setting is required for n > 0, though it 20 | # may be set to blank (e.g. "server.dbname.3=") 21 | -------------------------------------------------------------------------------- /src/module-info.java: -------------------------------------------------------------------------------- 1 | //module org.hsqldb { 2 | // exports org.hsqldb.auth; 3 | // exports org.hsqldb.jdbc; 4 | // exports org.hsqldb.jdbc.pool; 5 | // exports org.hsqldb.lib; 6 | // exports org.hsqldb.lib.tar; 7 | // exports org.hsqldb.server; 8 | // exports org.hsqldb.trigger; 9 | // exports org.hsqldb.util; 10 | // 11 | // requires java.desktop; 12 | // requires java.logging; 13 | // requires java.naming; 14 | // requires java.sql; 15 | // requires java.xml; 16 | //} 17 | -------------------------------------------------------------------------------- /src/org/hsqldb/Server.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2019, The HSQL Development Group 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * Neither the name of the HSQL Development Group nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | 32 | package org.hsqldb; 33 | 34 | public class Server extends org.hsqldb.server.Server {} 35 | 36 | -------------------------------------------------------------------------------- /src/org/hsqldb/Trigger.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2019, The HSQL Development Group 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * Neither the name of the HSQL Development Group nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | 32 | package org.hsqldb; 33 | 34 | public interface Trigger extends org.hsqldb.trigger.Trigger {} 35 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains command-line utilities. 4 | See 5 | the SqlTool chapter of the 6 | HyperSQL Utilities Guide 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/SqlFile.banner.text: -------------------------------------------------------------------------------- 1 | SqlFile processor v. %{1}. 2 | Distribution is permitted under the terms of the HSQLDB license. 3 | (c) 2004-2011 Blaine Simpson and the HSQL Development Group. 4 | 5 | \q to Quit. 6 | \? lists Special Commands. 7 | :? lists Edit-Buffer/History commands. 8 | *? lists PL commands. 9 | /? displays help on how to set and use macros (incl. functions). 10 | 11 | SPECIAL Commands begin with '\' and execute when you hit ENTER. 12 | EDIT-BUFFER / HISTORY Commands begin with ':' and execute when you hit ENTER. 13 | PROCEDURAL LANGUAGE commands begin with '*' and end when you hit ENTER. 14 | MACRO executions and definitions begin with '/' and end when you hit ENTER. 15 | All other lines comprise SQL Statements (or comments). 16 | SQL Statements are terminated by either unquoted ';' (which executes the 17 | statement), or a blank line (which moves the statement into the edit buffer 18 | without executing). 19 | After turning on variable expansion with command "*" (or any other PL 20 | command), PL variables may be used in most commands like so: *{PLVARNAME}. 21 | Be aware when using regular expressions on commands, that the regex.s 22 | operate only on the command text after the * or \ prefix, if any. 23 | 24 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/SqlFile.banner_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/SqlFile.banner_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/SqlTool.syntax_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/SqlTool.syntax_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/bottom-boilerplate.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/buffer.help_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/buffer.help_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/d.options.text: -------------------------------------------------------------------------------- 1 | \dX [parameter...] where X is one of the following. 2 | a: list Aliases 3 | c: list Catalogs 4 | i: list Indexes (for some databases, must specify literal target table) 5 | n: list schema Names 6 | r: list Roles 7 | s: list Sequences 8 | S: list System tables 9 | t: list Tables 10 | u: list Users 11 | v: list Views 12 | *: list table-like objects 13 | In most cases, 'parameter...' is a case-specific SUBSTRING to narrow matches. 14 | The following details apply to those commands which list schema objects. 15 | By default, objects in all schemas will be listed (excepting some exclusions 16 | for system schemas or system objects), with filtering if specified. 17 | If a filter param is supplied and begins with a dot, then the search is 18 | narrowed to the session's current schema. 19 | If the filter param contains a dot in any other position, then the characters 20 | before the dot specify a literal and case-sensitive schema name. 21 | Some or all of these dot filters will not work if your database doesn't support 22 | schemas according to the SQL specifications. 23 | 24 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/d.options_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/d.options_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/dsv.options_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/dsv.options_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/errorat.text: -------------------------------------------------------------------------------- 1 | Error at '%{1}' line %{2}: 2 | %{3:+"%3" 3 | }%{4} 4 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/errorat_de.text: -------------------------------------------------------------------------------- 1 | Fehler an '%{1}' Zeile %{2}: 2 | %{3:+"%3" 3 | }%{4} 4 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/macro.help_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/macro.help_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/pl.help_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/pl.help_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/raw.leadin.text: -------------------------------------------------------------------------------- 1 | Enter RAW SQL. No \, :, * commands. 2 | End with a line containing only ".;" to send to database, 3 | or only "." to store to edit buffer for editing or saving. 4 | ----------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/raw.leadin_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/raw.leadin_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/rejectreport.bottom.text: -------------------------------------------------------------------------------- 1 | %{1} 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/rejectreport.bottom_de.text: -------------------------------------------------------------------------------- 1 | %{1} 2 | 3 | 4 | 5 |
SqlFile Revision %{2}.
6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/rejectreport.row.text: -------------------------------------------------------------------------------- 1 | 2 | %{2} 3 | %{3} 4 | %{4} 5 |
%{5}
6 | 7 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/rejectreport.top.text: -------------------------------------------------------------------------------- 1 | 8 | 9 |

10 | Input DSV file: %{1} 11 |

12 |

13 | Reject DSV file: %{2} 14 |

15 | %{3:+ 16 |

17 | The corresponding records in '%3' 18 | are at line numbers of (reject # + 1), since the 19 | header record occupies the first line. 20 |

21 | } 22 | 23 | 24 | 25 | 26 | 27 | 29 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/rejectreport.top_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/rejectreport.top_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool/special.help_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool/special.help_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/cmdline/sqltool_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/cmdline/sqltool_de.properties -------------------------------------------------------------------------------- /src/org/hsqldb/jdbc/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains the HyperSQL JDBC Driver, and other classes providing JDBC 4 | functionality and support. 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/org/hsqldb/jdbcDriver.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2019, The HSQL Development Group 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * Neither the name of the HSQL Development Group nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | 32 | package org.hsqldb; 33 | 34 | public class jdbcDriver extends org.hsqldb.jdbc.JDBCDriver {} 35 | 36 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/Notified.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2019, The HSQL Development Group 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * Neither the name of the HSQL Development Group nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | 32 | package org.hsqldb.lib; 33 | 34 | public interface Notified { 35 | void notify(int id); 36 | } 37 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Shared classes used by other HyperSQL classes. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains the DbBackup class, for backing up HyperSQL databases, and support 4 | classes for handling files in tar and pax format. 5 | See 6 | the database backup section of the HyperSQL User Guide 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/DbBackup.syntax.text: -------------------------------------------------------------------------------- 1 | SYNTAX: 2 | java -cp path/to/hsqldb.jar %{1} 3 | (to display this message) 4 | OR 5 | java -cp path/to/hsqldb.jar %{1} --save \ 6 | [--overwrite] tar/path.tar db/base/path 7 | OR 8 | java -cp path/to/hsqldb.jar %{1} --list \ 9 | tar/path.tar [regex1...] 10 | OR 11 | java -cp path/to/hsqldb.jar %{1} --extract \ 12 | [--overwrite] file/path.tar[.gz] db/dir [regex1...] 13 | (extracts entry files to the specified db/dir). 14 | 15 | N.b. the db/base/path includes file base name, like in JDBC URLs, whereas 16 | db/dir is a proper 'directory'. 17 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/DbBackup.syntax_de.text: -------------------------------------------------------------------------------- 1 | SYNTAX: 2 | java -cp Pfad/zur/hsqldb.jar %{1} 3 | (um diese Meldung anzuzeigen) 4 | ODER 5 | java -cp Pfad/zur/hsqldb.jar %{1} --save \ 6 | [--overwrite] tar/Pfad.tar DB-Wurzel-Pfad 7 | ODER 8 | java -cp Pfad/zur/hsqldb.jar %{1} --list \ 9 | tar/Pfad.tar [regex1...] 10 | ODER 11 | java -cp path/to/hsqldb.jar %{1} --extract \ 12 | [--overwrite] Datei/Pfad.tar[.gz] DB/Verz. [regex1...] 13 | (entpackt die enthaltenen Dateien in die angegebene DB/das angegebene Verzeichnis). 14 | 15 | Bitte beachten: 16 | #N.b. the db/base/path includes file base name, like in JDBC URLs, whereas 17 | #db/dir is a proper 'directory'. 18 | Der DB-Wurzel-Pfad beinhaltet auch das Wurzelverzeichnis der Datei, 19 | wie bei JDBC-URLs, wo das DB/Verz. eine normales Verzeichnis ist. 20 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/TarGenerator.syntax.text: -------------------------------------------------------------------------------- 1 | SYNTAX: java -cp %{1} new.tar [entryFile1...] 2 | If no entryFiles are specified, stdin will be read to write an entry with 3 | name 'stdin'. In this latter case, input is limited to 10240 bytes. 4 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/TarGenerator.syntax_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/TarReader.syntax.text: -------------------------------------------------------------------------------- 1 | SYNTAX: java -cp path/to/hsqldb.jar %{1} {t|x} \ 2 | [--directory=path] file/path/tar[.gz] [regex1...] 3 | where 4 | t: Table-of-content mode (like "tar -t...") 5 | x: Extract mode (like "tar -x...") 6 | path: Base extraction directory for relative entries 7 | regex*: Pattern(s) which narrow entries listed or extracted 8 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/TarReader.syntax_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/lib/tar/rb/TarReader.syntax_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/listing.format.text: -------------------------------------------------------------------------------- 1 | LISTING FORMAT: 2 | modification_time__ tu mode file_size_ owner___ filepath 3 | t = Tar entry type 4 | u = '*' for UStar-compliant entry 5 | -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb/listing.format_de.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/lib/tar/rb/listing.format_de.text -------------------------------------------------------------------------------- /src/org/hsqldb/lib/tar/rb_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/lib/tar/rb_de.properties -------------------------------------------------------------------------------- /src/org/hsqldb/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains basic HyperSQL engine classes. 4 | See 5 | the HyperSQL User Guide for details about HyperSQL database 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/org/hsqldb/resources/info-column-remarks.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/resources/info-column-remarks.properties -------------------------------------------------------------------------------- /src/org/hsqldb/resources/jdklogging-default.properties: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | # As this is a Java .properties file, use ISO-8859-1 encoding for any 4 | # extended characters. 5 | 6 | # See http://java.sun.com/javase/6/docs/technotes/guides/logging/overview.html 7 | # for an overview of the JDK logging system, aka the Java Logging API, JUL, or 8 | # java.util.logging. 9 | # If you want more, and easier, control, particularly over the format of 10 | # output records, use Log4J instead. 11 | 12 | # When HSQLDB's FrameworkLogger loads this configuration, it also 13 | # programmatically adds a ConsoleHandler just for packages under 14 | # org.hsqldb.cmdline, because JDK logging doesn't support declarative 15 | # package-specific Handler configuration like this. 16 | # It then programmatically adds additional catalog-specific FileHandlers as 17 | # catalogs come online. 18 | 19 | handlers=java.util.logging.ConsoleHandler 20 | .level=ALL 21 | 22 | java.util.logging.ConsoleHandler.level=WARNING 23 | java.util.logging.ConsoleHandler.formatter=org.hsqldb.lib.BasicTextJdkLogFormatter 24 | 25 | #java.util.logging.FileHandler.pattern=hsqldb.applog 26 | #java.util.logging.FileHandler.limit=50000 27 | #java.util.logging.FileHandler.count=1 28 | #java.util.logging.FileHandler.append=true 29 | #java.util.logging.FileHandler.formatter=org.hsqldb.lib.BasicTextJdkLogFormatter 30 | #java.util.logging.FileHandler.level=WARNING 31 | -------------------------------------------------------------------------------- /src/org/hsqldb/resources/sql-state-messages_es.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/resources/sql-state-messages_es.properties -------------------------------------------------------------------------------- /src/org/hsqldb/resources/webserver-pages.properties: -------------------------------------------------------------------------------- 1 | # English WebServer responses 2 | BAD_REQUEST=

Bad Request

The server could not understand this request.

3 | NOT_FOUND=

Not Found

The server could not find this file.

4 | FORBIDDEN=

Forbidden

Access is not allowed.

-------------------------------------------------------------------------------- /src/org/hsqldb/sample/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contains examples for hooking into HyperSQL from your own Java code. 4 |

5 | Other examples may be found in the sample/ subdirectory of 6 | your HyperSQL distribution 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/org/hsqldb/server/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | The HyperSQL network listener classes. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/org/hsqldb/util/Bold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/Bold.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/Clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/Clear.png -------------------------------------------------------------------------------- /src/org/hsqldb/util/Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/Close.png -------------------------------------------------------------------------------- /src/org/hsqldb/util/Colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/Colors.png -------------------------------------------------------------------------------- /src/org/hsqldb/util/GreenCircle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/GreenCircle.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/Hourglass.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/Hourglass.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/Italic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/Italic.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/NoWay.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/NoWay.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/RedCircle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/RedCircle.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/hsqldb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/hsqldb.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/hsqldbtab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/hsqldbtab.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/problems.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/problems.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/run_exc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/run_exc.gif -------------------------------------------------------------------------------- /src/org/hsqldb/util/run_exc_running.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/src/org/hsqldb/util/run_exc_running.gif -------------------------------------------------------------------------------- /stylesheets/html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 11 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfArithmetic.txt: -------------------------------------------------------------------------------- 1 | drop table arith if exists; 2 | create table arith ( inta int, intb int, intc int ); 3 | insert into arith ( inta, intb, intc ) values ( 1, 2, 3 ); 4 | insert into arith ( inta, intb, intc ) values ( 3, 5, 7 ); 5 | insert into arith ( inta, intb, intc ) values ( 7, 11, 13 ); 6 | insert into arith ( inta, intb, intc ) values ( 13, 17, 19 ); 7 | 8 | select inta, intb from arith order by inta; 9 | select inta, inta + intb from arith order by inta; 10 | select inta, inta * intb from arith order by inta; 11 | select inta, inta - intb from arith order by inta; 12 | select inta, ( inta - intb ) * intc from arith order by inta; 13 | select inta, ( inta + intb ) * intc from arith order by inta; 14 | select inta, ( inta - intb ) + intc from arith order by inta; 15 | select inta, ( inta + intb ) + intc from arith order by inta; 16 | select inta, (inta-intb)*intc from arith order by inta; 17 | select inta, (inta+intb)*intc from arith order by inta; 18 | select inta, (inta-intb)+intc from arith order by inta; 19 | select inta, (inta+intb)+intc from arith order by inta; 20 | select inta, intc * ( inta - intb ) from arith order by inta; 21 | select inta, intc * ( inta + intb ) from arith order by inta; 22 | select inta, intc - ( inta + intb ) from arith order by inta; 23 | 24 | drop table arith; 25 | 26 | create table arith ( inta int, intb int, intc int ); 27 | insert into arith ( inta, intb, intc ) values ( 1, 2, 3 ); 28 | select inta, ( inta - intb ) * intc from arith order by inta; 29 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfConversions.txt: -------------------------------------------------------------------------------- 1 | DROP TABLE T1 IF EXISTS; 2 | CREATE TABLE T1(ID IDENTITY, DT DATE,TI TIME,TS TIMESTAMP); 3 | INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP); 4 | SELECT DAYOFMONTH(DT) FROM T1; 5 | SELECT DAYOFMONTH(TS) FROM T1; 6 | DELETE FROM T1; 7 | INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, DATE'2000-11-10', TIME'10:11:12',TIMESTAMP'2000-12-10 10:11:12'); 8 | /*r2000*/SELECT YEAR(TS) FROM T1; 9 | /*r12*/SELECT MONTH(TS) FROM T1; 10 | /*r10*/SELECT DAYOFMONTH(DT) FROM T1; 11 | /*r10*/SELECT DAYOFMONTH(TS) FROM T1; 12 | /*r10-01*/SELECT (DATE'2010-12-20' - DT) YEAR TO MONTH FROM T1; 13 | /*r121*/SELECT (DATE'2010-12-20' - DT) MONTH(4) FROM T1; 14 | /*r9-11*/SELECT (DATE'2010-10-20' - DT) YEAR TO MONTH FROM T1; 15 | /*r9-10*/SELECT (DATE'2010-10-20' - (MAX(DT) + INTERVAL '1' MONTH)) YEAR TO MONTH FROM T1; 16 | DROP TABLE T1 17 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfImmediateShutdown.txt: -------------------------------------------------------------------------------- 1 | SET AUTOCOMMIT FALSE; 2 | CREATE TABLE TABLE1(USER_ID INT NOT NULL PRIMARY KEY ); 3 | INSERT INTO TABLE1 (USER_ID) VALUES (1); 4 | INSERT INTO TABLE1 (USER_ID) VALUES (2); 5 | INSERT INTO TABLE1 (USER_ID) VALUES (3); 6 | INSERT INTO TABLE1 (USER_ID) VALUES (4); 7 | CREATE TABLE TABLE2(USER_ID INT NOT NULL, COLUMN2 SMALLINT DEFAULT 0 NOT NULL, 8 | COLUMN3 CHARACTER(10) DEFAULT 'TEST') ; 9 | ALTER TABLE TABLE2 ADD CONSTRAINT USER_FK FOREIGN KEY (USER_ID) REFERENCES TABLE1(USER_ID); 10 | CREATE INDEX USER_FK ON TABLE2(USER_ID); 11 | INSERT INTO TABLE2 (USER_ID) VALUES ( 1 ) ; 12 | INSERT INTO TABLE2 (USER_ID) VALUES ( 2 ) ; 13 | INSERT INTO TABLE2 (USER_ID) VALUES ( 3 ) ; 14 | INSERT INTO TABLE2 (USER_ID) VALUES ( 4 ) ; 15 | UPDATE TABLE2 SET COLUMN2=15 WHERE USER_ID=3; 16 | COMMIT; 17 | /*c4*/SELECT * FROM TABLE1; 18 | /*c4*/SELECT * FROM TABLE2; 19 | /*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15; 20 | 21 | -- bug #1110517 22 | DROP TABLE FILE2 IF EXISTS; 23 | CREATE TABLE FILE2(ID VARCHAR(10) PRIMARY KEY,NAME 24 | VARCHAR(10),DESCRIPTION VARCHAR(10), field1 INT, field2 25 | VARCHAR(10)); 26 | -- DESCRIPTION must be NULL 27 | /*u1*/insert into file2(id, name) values('14', 'dir'); 28 | /*u1*/update file2 set name = 'newdir' where id = '14'; 29 | COMMIT; 30 | SHUTDOWN IMMEDIATELY; 31 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfImmediateShutdownRecover.txt: -------------------------------------------------------------------------------- 1 | /*c4*/SELECT * FROM TABLE1; 2 | /*c4*/SELECT * FROM TABLE2; 3 | /*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15; 4 | -- bug #1110517 5 | /*rnewdir*/SELECT NAME FROM FILE2; 6 | DROP TABLE FILE2; 7 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfInPredicate.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/test-src/org/hsqldb/jdbc/resources/sql/TestSelfInPredicate.txt -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfInsteadOfTriggers.txt: -------------------------------------------------------------------------------- 1 | drop table testtrig12 if exists; 2 | drop table testtrig13 if exists; 3 | create cached table testtrig12(id integer, data2 varchar(20), updated date); 4 | create cached table testtrig13(id integer, data3 varchar(20), op varchar(10)); 5 | create view viewinst (vid, vdata2, vdata3) as select id, data2, data3 from testtrig12 natural join testtrig13 6 | create trigger trigger2 instead of insert on viewinst 7 | referencing new row as newrow 8 | for each row 9 | begin atomic 10 | insert into testtrig12 values(newrow.vid, newrow.vdata2, current_date); 11 | insert into testtrig13 values (newrow.vid, newrow.vdata3, 'inserted'); 12 | end 13 | 14 | create trigger trigger3 instead of delete on viewinst 15 | referencing old row as oldrow 16 | for each row 17 | begin atomic 18 | delete from testtrig12 where testtrig12.id = oldrow.vid; 19 | delete from testtrig13 where testtrig13.id = oldrow.vid; 20 | end 21 | 22 | create trigger trigger14 instead of update on viewinst 23 | referencing old row as oldrow new row as newrow 24 | for each row 25 | begin atomic 26 | update testtrig12 set data2 = newrow.vdata2, updated = current_date where testtrig12.id = oldrow.vid; 27 | update testtrig13 set data3 = newrow.vdata3, op = 'updated' where testtrig13.id = oldrow.vid; 28 | end 29 | 30 | insert into viewinst values (1, 'data2 value1', 'data3 value1') 31 | insert into viewinst values (2, 'data2 value2', 'data3 value2') 32 | 33 | /*r 34 | 1,data3 value1,inserted 35 | 2,data3 value2,inserted 36 | */select * from testtrig13 37 | 38 | update viewinst set vdata2='data2 updated1', vdata3='data3 updated1' where vid=1 39 | 40 | delete from viewinst 41 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfInternalFunctions.txt: -------------------------------------------------------------------------------- 1 | /*rXXX*/call trim(' XXX '); 2 | /*rXXX*/call trim(FROM ' XXX '); 3 | /*rXXX*/call trim(BOTH FROM ' XXX '); 4 | /*rXXX*/call trim(BOTH ' ' FROM ' XXX '); 5 | /*e*/call trim(BOTH FROM); 6 | /*rXXX*/call substring( ' XXX ' from 2 for 3); 7 | /*rXXX*/call substring( ' XXX' from 2); 8 | /*rXXXX*/call overlay( 'YYY' placing 'XXXX' from 1 for 3); 9 | /*rYXXYY*/call overlay( 'YYYYYY' placing 'XX' from 2 for 3); 10 | /*rXYY*/call overlay( 'YYY' placing 'X' from 1); 11 | /*rYXY*/call overlay( 'YYY' placing 'X' from 2); 12 | /*r0109090405*/call overlay( x'0102030405' placing x'0909' from 2); 13 | call current_timestamp; 14 | call current_timestamp(1); 15 | call current_time; 16 | call current_time(6); 17 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfNoDmlBug1.txt: -------------------------------------------------------------------------------- 1 | -- Tests a bug where with write_delay of 0, DML is not persisted until and 2 | -- if DML is committed or DB is "shutdown". If DB stops with no shutdown, 3 | -- all work is lost. 4 | 5 | --/*u0*/SET write_delay 0; 6 | /*u0*/CREATE SCHEMA ghostSchema AUTHORIZATION dba; 7 | /*u0*/SET SCHEMA ghostSchema; 8 | /*u0*/CREATE TABLE t1(i int); 9 | /*u0*/CREATE VIEW v1 AS SELECT * FROM t1; 10 | /*c0*/SELECT * FROM v1; 11 | /*c0*/SELECT * FROM t1; 12 | /*u0*/COMMIT; 13 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfNoDmlBug2.txt: -------------------------------------------------------------------------------- 1 | -- Tests a bug where with write_delay of 0, DML is not persisted until and 2 | -- if DML is committed or DB is "shutdown". If DB stops with no shutdown, 3 | -- all work is lost. 4 | 5 | /*u0*/SET SCHEMA ghostSchema; 6 | 7 | /*s*/DROP SCHEMA ghostSchema CASCADE; 8 | 9 | -- N.b. this test is unable to exhibit the problem because 10 | -- (a) It doesn't show when data is being written to the .log file; and 11 | -- (b) The test runner does a shutdown of some sort. To reproduce 12 | -- problem manually, just Ctrl-C out of the session. 13 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfOrderLimits.txt: -------------------------------------------------------------------------------- 1 | -- test maxrows 2 | create table test_maxrows(id int) 3 | insert into test_maxrows values(0); 4 | insert into test_maxrows select id+1 from test_maxrows; 5 | insert into test_maxrows select id+2 from test_maxrows; 6 | insert into test_maxrows select id+4 from test_maxrows; 7 | /*r 8 | 4 9 | 3 10 | 2 11 | 1 12 | */select id from test_maxrows order by id desc limit 4 offset 3 13 | /*r 14 | 4 15 | 3 16 | 2 17 | 1 18 | */select id from test_maxrows order by id desc offset 3 fetch 4 rows only 19 | /*r 20 | 4 21 | 3 22 | */select id from test_maxrows order by id desc limit 2 offset 3 23 | set maxrows 3 24 | /*c3*/select * from test_maxrows 25 | set maxrows 3 26 | /*c3*/select id from test_maxrows order by id desc 27 | set maxrows 3 28 | /*r 29 | 7 30 | 6 31 | 5 32 | */select id from test_maxrows order by id desc 33 | set maxrows 3 34 | /*r 35 | 4 36 | 3 37 | 2 38 | */select id from test_maxrows order by id desc limit 4 offset 3 39 | set maxrows 3 40 | /*r 41 | 4 42 | 3 43 | */select id from test_maxrows order by id desc limit 2 offset 3 44 | set maxrows 3 45 | /*r8*/select count(*) from test_maxrows 46 | set maxrows 3 47 | /*r7*/select max(id) from test_maxrows 48 | set maxrows 3 49 | /*c0*/select id from test_maxrows except select id from test_maxrows 50 | set maxrows 3 51 | /*c3*/select id from test_maxrows group by id 52 | set maxrows 0 53 | /*c8*/select * from test_maxrows 54 | /*c8*/select * from test_maxrows offset 0 55 | /*c8*/select limit 0 100 * from test_maxrows 56 | /*e*/select * from test_maxrows offset 0 limit 0 57 | drop table test_maxrows 58 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfPersSchemA.txt: -------------------------------------------------------------------------------- 1 | /*s*/DROP USER owner1; 2 | /*s*/DROP ROLE r1; 3 | /*s*/DROP SCHEMA schema_a; 4 | /*s*/DROP SCHEMA schema_b; 5 | /*s*/DROP SCHEMA schema_c; 6 | /*s*/DROP SCHEMA schema_z; 7 | 8 | -- Test basic ability to create schemas owned by individual DBAs, 9 | -- non-privileged users, and roles. 10 | /*u0*/CREATE USER owner1 password "pwerd"; 11 | /*u0*/CREATE USER adminowner1 password "pwerd"; 12 | /*u0*/CREATE ROLE r1; 13 | /*u0*/GRANT r1 TO owner1; 14 | /*u0*/CREATE SCHEMA schema_a AUTHORIZATION owner1; 15 | /*u0*/CREATE SCHEMA schema_b AUTHORIZATION r1; 16 | /*u0*/CREATE SCHEMA schema_c AUTHORIZATION adminowner1; 17 | /*e*/CREATE SCHEMA schema_z AUTHORIZATION nosuchowner; 18 | /*u0*/DROP SCHEMA schema_c; 19 | /*u0*/DROP USER adminowner1; 20 | 21 | /*u0*/ SHUTDOWN IMMEDIATELY; 22 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfSchemaMisc.txt: -------------------------------------------------------------------------------- 1 | drop schema schemafk1 if exists 2 | drop schema schemafk2 if exists 3 | create schema schemafk1 authorization dba; 4 | create table schemafk1.table1 ( table1_id integer primary key); 5 | create schema schemafk2 authorization dba; 6 | create table schemafk2.table2 (table2_id integer primary key, table1_id 7 | integer, foreign key (table1_id) references schemafk1.table1); 8 | create table schemafk2.table3 (table3_id integer primary key, table1_id integer); 9 | alter table schemafk2.table3 add constraint fktbl3 foreign key (table1_id) 10 | references schemafk1.table1; 11 | create table schemafk2.table4 (table4_id integer primary key, table1_id integer); 12 | alter table schemafk2.table4 add constraint fktbl4 foreign key (table1_id) 13 | references schemafk1.table1 (table1_id); 14 | 15 | comment on table schemafk1.table1 is 'a short table comment'; 16 | comment on column schemafk1.table1.table1_id is 'a short column comment'; 17 | 18 | /*c2*/select * from information_schema.system_comments where object_schema='SCHEMAFK1' 19 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfSchemaQuoting.txt: -------------------------------------------------------------------------------- 1 | -- Tests quoted schema names 2 | 3 | /*u0*/SET SCHEMA information_schema; 4 | /*u0*/CREATE SCHEMA sChEmA1 authorization sa; 5 | /*c1*/select * from schemata 6 | where schema_owner = 'SA' AND schema_name = 'SCHEMA1'; 7 | 8 | /*u0*/CREATE SCHEMA dEfAuLt authorization sa; 9 | /*c1*/select * from schemata 10 | where schema_name = 'DEFAULT'; 11 | 12 | /*u0*/SET INITIAL SCHEMA "DEFAULT"; 13 | /*c1*/SELECT * FROM system_users 14 | WHERE user_name = 'SA' AND initial_schema = 'DEFAULT'; 15 | 16 | /*u0*/SET INITIAL SCHEMA DEFAULT; 17 | /*c1*/SELECT * FROM system_users 18 | WHERE user_name = 'SA' AND initial_schema IS NULL; 19 | 20 | /*u0*/CREATE SCHEMA "mIxEdCaSe" AUTHORIZATION sa; 21 | /*c1*/select * from schemata where schema_name = 'mIxEdCaSe'; 22 | /*u0*/CREATE TABLE "mIxEdCaSe".t1(i int); 23 | /*e*/DROP TABLE mIxEdCaSe.t1; 24 | /*u0*/DROP TABLE "mIxEdCaSe".t1; 25 | /*e*/DROP SCHEMA mIxEdCaSe; 26 | /*u0*/DROP SCHEMA "mIxEdCaSe"; 27 | 28 | /*u0*/CREATE USER u1 PASSWORD "u1"; 29 | /*u0*/CREATE SCHEMA "oThErMiXeD" authorization u1; 30 | /*u0*/CREATE TABLE "oThErMiXeD".t2(i int); 31 | /*e*/DROP SCHEMA oThErMiXeD CASCADE; 32 | /*u0*/DROP SCHEMA "oThErMiXeD" CASCADE; 33 | 34 | /*s*/DROP USER u1 CASCADE; 35 | /*s*/DROP USER u1; 36 | /*s*/DROP SCHEMA schema1 CASCADE; 37 | 38 | /*U0*/ Workaround for bug where DDL will not Commit 39 | /*s*/CREATE TABLE bug_workaround (i int); 40 | /*s*/INSERT INTO bug_workaround VALUES(1); 41 | /*u0*/SHUTDOWN; 42 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfSeqRightsB.txt: -------------------------------------------------------------------------------- 1 | -- $Id: TestSelfSeqRightsB.txt 610 2008-12-22 15:54:18Z unsaved $ 2 | -- Test .log persistence of Sequence rights 3 | 4 | CONNECT USER blaine PASSWORD "b"; 5 | -- Following is default, but just to eliminate any ambiguity... 6 | SET SCHEMA public; 7 | -- By virtue of PUBLIC grants 8 | /*c1*/SELECT * FROM pt; 9 | /*e*/SELECT i, next value for ps9 FROM pt; 10 | /*e*/SELECT i, next value for public.ps9 FROM public.pt; 11 | /*e*/SELECT i, next value for ps9 FROM public.pt; 12 | /*c1*/SELECT i, next value for ps1 FROM pt; 13 | SET SCHEMA bsch; 14 | /*c1*/SELECT i, next value for public.ps2 FROM public.pt; 15 | -- Don't own 16 | /*e*/GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; 17 | /*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; 18 | -- By virtue of schema ownership 19 | /*c1*/SELECT i, next value for bs2 FROM bt; 20 | SET SCHEMA public; 21 | /*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; 22 | -- Enough schema specification testing. Just use defauls Session schema for 23 | -- here on in 24 | /*c1*/SELECT i FROM pt; 25 | /*e*/SELECT i, next value for ps3 FROM pt; 26 | /*e*/SELECT i, next value for ps4 FROM pt; 27 | /*c1*/SELECT i, next value for ps5 FROM pt; 28 | /*c1*/SELECT i, next value for ps6 FROM pt; 29 | /*e*/SELECT i, next value for ps7 FROM pt; 30 | /*e*/SELECT i, next value for ps8 FROM pt; 31 | 32 | CONNECT USER sa PASSWORD ""; 33 | SHUTDOWN; 34 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfSeqRightsC.txt: -------------------------------------------------------------------------------- 1 | -- $Id: TestSelfSeqRightsC.txt 610 2008-12-22 15:54:18Z unsaved $ 2 | -- Test .script persistence of Sequence rights 3 | 4 | CONNECT USER blaine PASSWORD "b"; 5 | -- Following is default, but just to eliminate any ambiguity... 6 | SET SCHEMA public; 7 | -- By virtue of PUBLIC grants 8 | /*e*/SELECT i, next value for ps9 FROM pt; 9 | /*e*/SELECT i, next value for public.ps9 FROM public.pt; 10 | /*e*/SELECT i, next value for ps9 FROM public.pt; 11 | /*c1*/SELECT i, next value for ps1 FROM pt; 12 | SET SCHEMA bsch; 13 | /*c1*/SELECT i, next value for public.ps2 FROM public.pt; 14 | -- Don't own 15 | /*e*/GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; 16 | /*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; 17 | -- By virtue of schema ownership 18 | /*c1*/SELECT i, next value for bs2 FROM bt; 19 | SET SCHEMA public; 20 | /*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; 21 | -- Enough schema specification testing. Just use defauls Session schema for 22 | -- here on in 23 | /*c1*/SELECT i FROM pt; 24 | /*e*/SELECT i, next value for ps3 FROM pt; 25 | /*e*/SELECT i, next value for ps4 FROM pt; 26 | /*c1*/SELECT i, next value for ps5 FROM pt; 27 | /*c1*/SELECT i, next value for ps6 FROM pt; 28 | /*e*/SELECT i, next value for ps7 FROM pt; 29 | /*e*/SELECT i, next value for ps8 FROM pt; 30 | 31 | -- Test REVOKES 32 | -- Can't revoke on objects you don't own 33 | /*e*/REVOKE ALL ON SEQUENCE public.ps6 FROM public RESTRICT; 34 | /*u0*/REVOKE ALL ON SEQUENCE bsch.bs1 FROM public RESTRICT; 35 | CONNECT USER sa PASSWORD ""; 36 | /*u0*/REVOKE USAGE ON SEQUENCE public.ps6 FROM BLAINE RESTRICT; 37 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfTempTable1.txt: -------------------------------------------------------------------------------- 1 | /*s*/DROP tmptbl1 IF EXISTS; 2 | /*s*/DROP tmptbl2 IF EXISTS; 3 | /*s*/DROP user altuser1; 4 | /*s*/DROP user altuser2; 5 | 6 | CREATE USER altuser1 PASSWORD password; 7 | CREATE USER altuser2 PASSWORD password; 8 | /*u0*/GRANT CHANGE_AUTHORIZATION TO altuser1; 9 | /*u0*/GRANT CHANGE_AUTHORIZATION TO altuser2; 10 | /*u0*/CREATE TEMP TABLE tmptbl1 (i int); 11 | /*u0*/CREATE TEMP TABLE tmptbl2 (i int); 12 | /*u0*/GRANT ALL ON tmptbl1 TO altuser1; 13 | /*u0*/GRANT ALL ON tmptbl2 TO altuser1; 14 | SET AUTOCOMMIT false; 15 | /*u1*/INSERT INTO tmptbl1 VALUES(1); 16 | /*u1*/INSERT INTO tmptbl1 VALUES(2); 17 | /*c2*/SELECT * FROM tmptbl1; 18 | COMMIT; 19 | /*u1*/INSERT INTO tmptbl2 VALUES(1); 20 | /*u1*/INSERT INTO tmptbl2 VALUES(2); 21 | /*c0*/SELECT * FROM tmptbl1; 22 | /*c2*/SELECT * FROM tmptbl2; 23 | COMMIT; 24 | 25 | CONNECT USER altuser1 PASSWORD password; 26 | /*c0*/SELECT * FROM tmptbl1; 27 | /*c0*/SELECT * FROM tmptbl2; 28 | COMMIT; 29 | 30 | CONNECT USER altuser2 PASSWORD password; 31 | /*e*/SELECT * FROM tmptbl1; 32 | /*e*/SELECT * FROM tmptbl2; 33 | CONNECT USER SA password ""; 34 | SHUTDOWN IMMEDIATELY; 35 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfTempTable2.txt: -------------------------------------------------------------------------------- 1 | -- This script depends on TestSelfTempTable1.txt to set up the objects tested. 2 | 3 | SET AUTOCOMMIT false; 4 | /*c0*/SELECT * FROM tmptbl1; 5 | /*c0*/SELECT * FROM tmptbl2; 6 | COMMIT; 7 | CONNECT USER altuser2 PASSWORD password; 8 | /*e*/SELECT * FROM tmptbl1; 9 | /*e*/SELECT * FROM tmptbl2; 10 | CONNECT USER altuser1 PASSWORD password; 11 | /*c0*/SELECT * FROM tmptbl1; 12 | /*c0*/SELECT * FROM tmptbl2; 13 | /*u1*/INSERT INTO tmptbl1 VALUES(1); 14 | /*u1*/INSERT INTO tmptbl1 VALUES(2); 15 | /*c2*/SELECT * FROM tmptbl1; 16 | COMMIT; 17 | -- Purposefully not committing these inserts 18 | /*c0*/SELECT * FROM tmptbl1; 19 | /*u1*/INSERT INTO tmptbl2 VALUES(1); 20 | /*u1*/INSERT INTO tmptbl2 VALUES(2); 21 | /*c2*/SELECT * FROM tmptbl2; 22 | ROLLBACK; 23 | CONNECT USER SA password ""; 24 | SHUTDOWN; 25 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfTrimSimplified.txt: -------------------------------------------------------------------------------- 1 | -- TestSelfTrimSimplified.txt 2 | -- 3 | -- trim looks different 4 | 5 | 6 | drop table testtable if exists; 7 | create cached table testtable ( 8 | aString varchar(256) not null, 9 | firstNum integer not null, 10 | aDate date not null, 11 | secondNum integer not null, 12 | thirdNum integer not null, 13 | aName varchar(32) not null 14 | ); 15 | 16 | insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) 17 | values (' XYZ ', 22, '2003-11-10', 18, 3, 'my name goes here'); 18 | 19 | select trim(aString) from testtable; 20 | drop table testtable; 21 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestSelfUserFunction.txt: -------------------------------------------------------------------------------- 1 | -- 2 | -- TestSelfUserFunction.txt 3 | -- 4 | -- This test checks if the USER() function works correctly when used within 5 | -- prepared statements such as VIEW's and constraints in TABLE's 6 | 7 | -- Setup tables and views 8 | DROP TABLE USER_PROFILE IF EXISTS 9 | CREATE TABLE USER_PROFILE(NAME VARCHAR(10), PROFILE INT) 10 | DROP VIEW USER_SECURITY_PROFILE_VIEW IF EXISTS 11 | CREATE VIEW USER_SECURITY_PROFILE_VIEW AS SELECT * FROM USER_PROFILE WHERE Name = USER() 12 | 13 | -- Create user for test 14 | CREATE USER MATT PASSWORD MATT ADMIN 15 | 16 | -- This checks that you are allowed to insert a row as long as your username matches the NAME field 17 | /*u1*/ INSERT INTO USER_PROFILE(NAME, PROFILE) VALUES('SA',10) 18 | 19 | -- Connect as MATT 20 | CONNECT USER MATT PASSWORD MATT 21 | 22 | -- Insert a row as the connected user 23 | /*u1*/ INSERT INTO USER_PROFILE(NAME, PROFILE) VALUES('MATT',20) 24 | 25 | -- There are two rows in the table but the select should only return the row 26 | -- associated with the connected user i.e. one row 27 | /*c1*/ SELECT COUNT(*) FROM USER_SECURITY_PROFILE_VIEW 28 | SHUTDOWN 29 | 30 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestText01.txt: -------------------------------------------------------------------------------- 1 | -- all_quoted 2 | drop table tmain if exists; 3 | create table tmain(c1 varchar(10),i1 integer, c2 varchar(10)); 4 | insert into tmain values(null, null, null); 5 | insert into tmain values('aval1', null, 'aval2'); 6 | drop table t if exists; 7 | create text table t(c1 varchar(10),i1 integer, c2 varchar(10)); 8 | set table t source "t.txt; all_quoted=true;ignore_first=true"; 9 | set table t source header """charcol_1"",""intcol"",""charcol_2"""; 10 | insert into t select * from tmain; 11 | -- unquoted 12 | create table ttmain(doublequote char(10), singlequote char(10)); 13 | insert into ttmain values('noquoteA', 'noquoteB'); 14 | insert into ttmain values('"inch','''foot'); 15 | insert into ttmain values('_""_','_''''_' ); 16 | insert into ttmain values('"quoted"','''quoted'''); 17 | insert into ttmain values('inch"','foot'''); 18 | insert into ttmain values('"inch"','''foot'''); 19 | create text table tt(doubquote char(10), singquote char(10)); 20 | set table tt source "tt.txt;quoted=false;fs=\t;ignore_first=true"; 21 | set table tt source header "DOUBQUOTE,SINGQUOTE"; 22 | insert into tt select * from ttmain; 23 | -- identity test 24 | drop table tident if exists; 25 | create text table tident(c1 int generated by default as identity, c2 varchar(20)); 26 | set table tident source "ttt.txt; all_quoted=true;ignore_first=true"; 27 | set table tident source header """IDENT"",""VAL"""; 28 | -- single column test 29 | drop table tsingle if exists; 30 | create text table tsingle(c1 int); 31 | set table tsingle source "tttt.txt;ignore_first=true"; 32 | set table tsingle source header 'full history'; 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestText02.txt: -------------------------------------------------------------------------------- 1 | /*c2*/SELECT * FROM TMAIN; 2 | /*c0*/SELECT * FROM TMAIN EXCEPT SELECT * FROM T; 3 | /*c0*/SELECT * FROM T EXCEPT SELECT * FROM TMAIN; 4 | /*c6*/SELECT * FROM TTMAIN; 5 | /*c0*/SELECT * FROM TT EXCEPT SELECT * FROM TTMAIN; 6 | /*c0*/SELECT * FROM TTMAIN EXCEPT SELECT * FROM TT; 7 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/sql/TestTriggers.txt: -------------------------------------------------------------------------------- 1 | drop table testtrig if exists; 2 | create cached table testtrig(c1 integer generated by default as identity, c2 varchar(40), c3 integer); 3 | create trigger tbir before insert on testtrig referencing new row as newrow 4 | for each row when (c2 is not null) 5 | call "org.hsqldb.test.TriggerClass"; 6 | create trigger tair after insert on testtrig referencing new row as newrow 7 | for each row when (c2 is not null) 8 | call "org.hsqldb.test.TriggerClass"; 9 | create trigger tais after insert on testtrig 10 | for each statement 11 | call "org.hsqldb.test.TriggerClass"; 12 | create trigger tbur before update of c1, c2, c3 on testtrig referencing new row as newrow 13 | for each row when (c2 is not null) 14 | call "org.hsqldb.test.TriggerClass"; 15 | create trigger taur after update on testtrig referencing new row as newrow 16 | for each row when (c2 is not null) 17 | call "org.hsqldb.test.TriggerClass"; 18 | create trigger taus after update on testtrig 19 | for each statement 20 | call "org.hsqldb.test.TriggerClass"; 21 | create trigger tbdr before delete on testtrig referencing old row as oldrow 22 | for each row when (c2 is not null) 23 | call "org.hsqldb.test.TriggerClass"; 24 | create trigger tadr after delete on testtrig referencing old row as oldrow 25 | for each row when (c2 is not null) 26 | call "org.hsqldb.test.TriggerClass"; 27 | create trigger tads after delete on testtrig 28 | for each statement 29 | call "org.hsqldb.test.TriggerClass"; 30 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/xml/MyDoc.xml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/test-src/org/hsqldb/jdbc/resources/xml/MyDoc.xml.zip -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/xml/MyEntity.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | Testing JDBCSQLXML <> stuff %apos;]]>> 10 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/xml/mydoc_1_0.dtd: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 30 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/xml/websvc_ref.dtd: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/resources/xml/websvc_ref.xml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/test-src/org/hsqldb/jdbc/resources/xml/websvc_ref.xml.zip -------------------------------------------------------------------------------- /test-src/org/hsqldb/jdbc/setup-dual-table.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE DUAL IF EXISTS; 2 | 3 | CREATE TABLE DUAL(DUMMY VARCHAR(256)); 4 | 5 | INSERT INTO DUAL VALUES(NULL); 6 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/resources/jaas.cfg: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010, The HSQL Development Group. All rights reserved. 3 | Released under the HSQL license, available at http://hsqldb.org 4 | 5 | JAAS config file used by unit test JaasAuthBeanTest. 6 | */ 7 | 8 | test { 9 | /* 10 | * A trivial module that allows access if user name and password start with 11 | * the specified values. 12 | */ 13 | org.hsqldb.auth.StartCharModule required 14 | //debug=true 15 | nameStart="a" 16 | pwdStart="b" 17 | ; 18 | }; 19 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/resources/odbcPacket.data: -------------------------------------------------------------------------------- 1 | a\   kEin groß Baum 2 | with blossomAnother stringEin groß Baum 3 | mit blossom -------------------------------------------------------------------------------- /test-src/org/hsqldb/resources/pif.data: -------------------------------------------------------------------------------- 1 | 6 o=n 2 | 8 k1=23 3 | 10 k2=234 4 | 11 k3=2345 5 | 98 k4=2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 6 | 100 k5=23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 7 | 16 int1234=1234 8 | 17 long1234=1234 9 | 17 boolTrue=true 10 | 19 boolFalse=false 11 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/util/preprocessor/ATest.exp: -------------------------------------------------------------------------------- 1 | class ATest { 2 | // JDBC Version is GTE 4: 3 | String msg4 = "I was included because jdbc_version was GTE 4"; 4 | // JDBC Version is GTE 3 and LT 4: 5 | String msg3 = "I was included because jdbc_version was GTE 3 and LT 4"; 6 | // JDBC Version is GTE 2 and LT 3: 7 | String msg2 = "I was included because jdbc_version was GTE 2 and LT 3"; 8 | String s1 = "v1 was defined"; 9 | String s2 = "v2 was defined"; 10 | String s3 = "v1 was \"happy\""; 11 | String s4 = "v2 was \"sad\""; 12 | String s5 = "v1 was less than or equal to v2"; 13 | } 14 | -------------------------------------------------------------------------------- /test-src/org/hsqldb/util/preprocessor/ATest.src: -------------------------------------------------------------------------------- 1 | class ATest { 2 | //#ifndef jdbc_version 3 | // jdbc_version was not defined: 4 | //#else 5 | //#include Main.inc 6 | //#endinclude 7 | //#endif 8 | //#define jdbc_version 3 9 | //#include Main.inc 10 | //#endinclude 11 | //#define jdbc_version 2 12 | //#include Main.inc 13 | //#endinclude 14 | //#define v1 "happy" 15 | //#define v2 "sad" 16 | //#ifdef v1 17 | String s1 = "v1 was defined"; 18 | //#ifdef v2 19 | String s2 = "v2 was defined"; 20 | //#if (v1 == "happy") 21 | String s3 = "v1 was \"happy\""; 22 | //#if (v2 == "sad") 23 | String s4 = "v2 was \"sad\""; 24 | //#if (v1 <= v2) 25 | String s5 = "v1 was less than or equal to v2"; 26 | //#else 27 | String s5 = "v1 was greater than v2"; 28 | //#endif (v1 <= v2) 29 | //#else 30 | String s4 = "v2 was not \"sad\""; 31 | //#endif (v2 == "sad") 32 | //#else 33 | String s3 = "v2 was not defined or v1 was not \"happy\""; 34 | //#endif (v1 == "happy") 35 | //#else 36 | String s2 = "v2 was not defined"; 37 | //#endif v1 38 | //#else 39 | String s1 = "v1 was not defined"; 40 | //#endif v1 41 | } -------------------------------------------------------------------------------- /test-src/org/hsqldb/util/preprocessor/Jdbc2.inc: -------------------------------------------------------------------------------- 1 | String msg2 = "I was included because jdbc_version was GTE 2 and LT 3"; -------------------------------------------------------------------------------- /test-src/org/hsqldb/util/preprocessor/Jdbc3.inc: -------------------------------------------------------------------------------- 1 | String msg3 = "I was included because jdbc_version was GTE 3 and LT 4"; -------------------------------------------------------------------------------- /test-src/org/hsqldb/util/preprocessor/Jdbc4.inc: -------------------------------------------------------------------------------- 1 | String msg4 = "I was included because jdbc_version was GTE 4"; -------------------------------------------------------------------------------- /test-src/org/hsqldb/util/preprocessor/Main.inc: -------------------------------------------------------------------------------- 1 | //#if (jdbc_version >= 4) 2 | // JDBC Version is GTE 4: 3 | //#include Jdbc4.inc 4 | // This is where the JDBC 4 stuff will go... 5 | //#endinclude 6 | //#elif (jdbc_version >= 3) 7 | // JDBC Version is GTE 3 and LT 4: 8 | //#include Jdbc3.inc 9 | // This is where the JDBC 3 stuff will go... 10 | //#endinclude 11 | //#elif (jdbc_version >= 2) 12 | // JDBC Version is GTE 2 and LT 3: 13 | //#include Jdbc2.inc 14 | // This is where the JDBC 2 stuff will go... 15 | //#endinclude 16 | //#elif (jdbc_version >= 1) 17 | // JDBC Version is GTE 1 and LT 2: 18 | //#else 19 | // JDBC Version is LT 1: 20 | //#endif -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/HSQLDB-Research/b845916d29d3c7aa92fa1d20b502545c10d620d6/testrun/hsqldb/TestSelf.txt -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfArithmetic.txt: -------------------------------------------------------------------------------- 1 | drop table arith if exists; 2 | create table arith ( inta int, intb int, intc int ); 3 | insert into arith ( inta, intb, intc ) values ( 1, 2, 3 ); 4 | insert into arith ( inta, intb, intc ) values ( 3, 5, 7 ); 5 | insert into arith ( inta, intb, intc ) values ( 7, 11, 13 ); 6 | insert into arith ( inta, intb, intc ) values ( 13, 17, 19 ); 7 | 8 | select inta, intb from arith order by inta; 9 | select inta, inta + intb from arith order by inta; 10 | select inta, inta * intb from arith order by inta; 11 | select inta, inta - intb from arith order by inta; 12 | select inta, ( inta - intb ) * intc from arith order by inta; 13 | select inta, ( inta + intb ) * intc from arith order by inta; 14 | select inta, ( inta - intb ) + intc from arith order by inta; 15 | select inta, ( inta + intb ) + intc from arith order by inta; 16 | select inta, (inta-intb)*intc from arith order by inta; 17 | select inta, (inta+intb)*intc from arith order by inta; 18 | select inta, (inta-intb)+intc from arith order by inta; 19 | select inta, (inta+intb)+intc from arith order by inta; 20 | select inta, intc * ( inta - intb ) from arith order by inta; 21 | select inta, intc * ( inta + intb ) from arith order by inta; 22 | select inta, intc - ( inta + intb ) from arith order by inta; 23 | 24 | drop table arith; 25 | 26 | create table arith ( inta int, intb int, intc int ); 27 | insert into arith ( inta, intb, intc ) values ( 1, 2, 3 ); 28 | select inta, ( inta - intb ) * intc from arith order by inta; 29 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfConversions.txt: -------------------------------------------------------------------------------- 1 | DROP TABLE T1 IF EXISTS; 2 | CREATE TABLE T1(ID IDENTITY, DT DATE,TI TIME,TS TIMESTAMP); 3 | INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP); 4 | SELECT DAYOFMONTH(DT) FROM T1; 5 | SELECT DAYOFMONTH(TS) FROM T1; 6 | DELETE FROM T1; 7 | INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, DATE'2000-11-10', TIME'10:11:12',TIMESTAMP'2000-12-10 10:11:12'); 8 | /*r2000*/SELECT YEAR(TS) FROM T1; 9 | /*r12*/SELECT MONTH(TS) FROM T1; 10 | /*r10*/SELECT DAYOFMONTH(DT) FROM T1; 11 | /*r10*/SELECT DAYOFMONTH(TS) FROM T1; 12 | /*r10-01*/SELECT (DATE'2010-12-20' - DT) YEAR TO MONTH FROM T1; 13 | /*r121*/SELECT (DATE'2010-12-20' - DT) MONTH(4) FROM T1; 14 | /*r9-11*/SELECT (DATE'2010-10-20' - DT) YEAR TO MONTH FROM T1; 15 | /*r9-10*/SELECT (DATE'2010-10-20' - (MAX(DT) + INTERVAL '1' MONTH)) YEAR TO MONTH FROM T1; 16 | /*r249616216198.000000*/SELECT (TIMESTAMP'9910-12-20 00:01:10' - TS) SECOND FROM T1; 17 | 18 | DROP TABLE T1 19 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfImmediateShutdown.txt: -------------------------------------------------------------------------------- 1 | SET AUTOCOMMIT FALSE; 2 | CREATE TABLE TABLE1(USER_ID INT NOT NULL PRIMARY KEY ); 3 | INSERT INTO TABLE1 (USER_ID) VALUES (1); 4 | INSERT INTO TABLE1 (USER_ID) VALUES (2); 5 | INSERT INTO TABLE1 (USER_ID) VALUES (3); 6 | INSERT INTO TABLE1 (USER_ID) VALUES (4); 7 | CREATE TABLE TABLE2(USER_ID INT NOT NULL, COLUMN2 SMALLINT DEFAULT 0 NOT NULL, 8 | COLUMN3 CHARACTER(10) DEFAULT 'TEST') ; 9 | ALTER TABLE TABLE2 ADD CONSTRAINT USER_FK FOREIGN KEY (USER_ID) REFERENCES TABLE1(USER_ID); 10 | CREATE INDEX USER_FK ON TABLE2(USER_ID); 11 | INSERT INTO TABLE2 (USER_ID) VALUES ( 1 ) ; 12 | INSERT INTO TABLE2 (USER_ID) VALUES ( 2 ) ; 13 | INSERT INTO TABLE2 (USER_ID) VALUES ( 3 ) ; 14 | INSERT INTO TABLE2 (USER_ID) VALUES ( 4 ) ; 15 | UPDATE TABLE2 SET COLUMN2=15 WHERE USER_ID=3; 16 | COMMIT; 17 | /*c4*/SELECT * FROM TABLE1; 18 | /*c4*/SELECT * FROM TABLE2; 19 | /*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15; 20 | 21 | -- bug #1110517 22 | DROP TABLE FILE2 IF EXISTS; 23 | CREATE TABLE FILE2(ID VARCHAR(10) PRIMARY KEY,NAME 24 | VARCHAR(10),DESCRIPTION VARCHAR(10), field1 INT, field2 25 | VARCHAR(10)); 26 | -- DESCRIPTION must be NULL 27 | /*u1*/insert into file2(id, name) values('14', 'dir'); 28 | /*u1*/update file2 set name = 'newdir' where id = '14'; 29 | COMMIT; 30 | SHUTDOWN IMMEDIATELY; 31 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfImmediateShutdownRecover.txt: -------------------------------------------------------------------------------- 1 | /*c4*/SELECT * FROM TABLE1; 2 | /*c4*/SELECT * FROM TABLE2; 3 | /*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15; 4 | -- bug #1110517 5 | /*rnewdir*/SELECT NAME FROM FILE2; 6 | DROP TABLE FILE2; 7 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfInternalFunctions.txt: -------------------------------------------------------------------------------- 1 | /*rXXX*/call trim(' XXX '); 2 | /*rXXX*/call trim(FROM ' XXX '); 3 | /*rXXX*/call trim(BOTH FROM ' XXX '); 4 | /*rXXX*/call trim(BOTH ' ' FROM ' XXX '); 5 | /*e*/call trim(BOTH FROM); 6 | /*rXXX*/call substring( ' XXX ' from 2 for 3); 7 | /*rXXX*/call substring( ' XXX' from 2); 8 | /*rXXXX*/call overlay( 'YYY' placing 'XXXX' from 1 for 3); 9 | /*rYXXYY*/call overlay( 'YYYYYY' placing 'XX' from 2 for 3); 10 | /*rXYY*/call overlay( 'YYY' placing 'X' from 1); 11 | /*rYXY*/call overlay( 'YYY' placing 'X' from 2); 12 | /*r0109090405*/call overlay( x'0102030405' placing x'0909' from 2); 13 | call current_timestamp; 14 | call current_timestamp(1); 15 | call current_time; 16 | call current_time(6); 17 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfJoins.txt: -------------------------------------------------------------------------------- 1 | -- 2 | -- TestSelfJoins.txt 3 | -- 4 | create table tsj1 (a integer primary key, b integer); 5 | insert into tsj1 values(5,5); 6 | insert into tsj1 values(6,6); 7 | insert into tsj1 values(11,21); 8 | insert into tsj1 values(12,22); 9 | insert into tsj1 values(13,23); 10 | insert into tsj1 values(14,24); 11 | insert into tsj1 values(15,25); 12 | insert into tsj1 values(16,26); 13 | insert into tsj1 values(17,27); 14 | /*r3*/select count(*) from tsj1 where a > 14 15 | /*r5*/select count(*) from tsj1 where cast(a as character(2)) > '14' 16 | /*r81*/select count(*) from tsj1 a cross join tsj1 b 17 | 18 | /*e*/select count(*) from tsj1 a cross join tsj1 b on a.a = b.a 19 | /*r9*/select count(*) from tsj1 a inner join tsj1 b on a.a = b.a 20 | 21 | drop table table1 if exists 22 | create table table1(column1 int not null, column2 varchar(255) not null, 23 | primary key(column1)) 24 | insert into table1(column1,column2) values(100,'string1') 25 | insert into table1(column1,column2) values(200,'string2') 26 | insert into table1(column1,column2) values(300,'string3') 27 | /*r3*/select count(1) rows from table1 28 | /*r0*/select count(1) rows from table1 where column1<300 and column1>=200 and column1<1 29 | /*r0*/select count(1) rows from table1 where column1<1 and column1<300 and column1>=200 30 | 31 | drop table t1 if exists; 32 | drop table t2 if exists; 33 | drop table t3 if exists; 34 | create table t1(id int primary key, c varchar(20)); 35 | create table t2(id int primary key, rid int, c varchar(20)); 36 | create table t3(id int primary key, rid int, c varchar(20)); 37 | insert into t1 values(1, 'one'), (2, 'two'), (10, 'ten'), (11, 'eleven'); 38 | insert into t2 values(1, 1, 'one'), (2, 2, 'two'), (3, 10, 'ten'), (4, 11, 'eleven'); 39 | insert into t3 values(1, 1, 'one'), (2, 2, 'two'), (3, 10, 'ten'), (4, 11, 'eleven'); 40 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfNoDmlBug1.txt: -------------------------------------------------------------------------------- 1 | -- Tests a bug where with write_delay of 0, DML is not persisted until and 2 | -- if DML is committed or DB is "shutdown". If DB stops with no shutdown, 3 | -- all work is lost. 4 | 5 | --/*u0*/SET write_delay 0; 6 | /*u0*/CREATE SCHEMA ghostSchema AUTHORIZATION dba; 7 | /*u0*/SET SCHEMA ghostSchema; 8 | /*u0*/CREATE TABLE t1(i int); 9 | /*u0*/CREATE VIEW v1 AS SELECT * FROM t1; 10 | /*c0*/SELECT * FROM v1; 11 | /*c0*/SELECT * FROM t1; 12 | /*u0*/COMMIT; 13 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfNoDmlBug2.txt: -------------------------------------------------------------------------------- 1 | -- Tests a bug where with write_delay of 0, DML is not persisted until and 2 | -- if DML is committed or DB is "shutdown". If DB stops with no shutdown, 3 | -- all work is lost. 4 | 5 | /*u0*/SET SCHEMA ghostSchema; 6 | 7 | /*s*/DROP SCHEMA ghostSchema CASCADE; 8 | 9 | -- N.b. this test is unable to exhibit the problem because 10 | -- (a) It doesn't show when data is being written to the .log file; and 11 | -- (b) The test runner does a shutdown of some sort. To reproduce 12 | -- problem manually, just Ctrl-C out of the session. 13 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfPersSchemA.txt: -------------------------------------------------------------------------------- 1 | /*s*/DROP USER owner1; 2 | /*s*/DROP ROLE r1; 3 | /*s*/DROP SCHEMA schema_a; 4 | /*s*/DROP SCHEMA schema_b; 5 | /*s*/DROP SCHEMA schema_c; 6 | /*s*/DROP SCHEMA schema_z; 7 | 8 | -- Test basic ability to create schemas owned by individual DBAs, 9 | -- non-privileged users, and roles. 10 | /*u0*/CREATE USER owner1 password "pwerd"; 11 | /*u0*/CREATE USER adminowner1 password "pwerd"; 12 | /*u0*/CREATE ROLE r1; 13 | /*u0*/GRANT r1 TO owner1; 14 | /*u0*/CREATE SCHEMA schema_a AUTHORIZATION owner1; 15 | /*u0*/CREATE SCHEMA schema_b AUTHORIZATION r1; 16 | /*u0*/CREATE SCHEMA schema_c AUTHORIZATION adminowner1; 17 | /*e*/CREATE SCHEMA schema_z AUTHORIZATION nosuchowner; 18 | /*u0*/DROP SCHEMA schema_c; 19 | /*u0*/DROP USER adminowner1; 20 | 21 | /*u0*/ SHUTDOWN IMMEDIATELY; 22 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfSchemaMisc.txt: -------------------------------------------------------------------------------- 1 | drop schema schemafk1 if exists 2 | drop schema schemafk2 if exists 3 | create schema schemafk1 authorization dba; 4 | create table schemafk1.table1 ( table1_id integer primary key); 5 | create schema schemafk2 authorization dba; 6 | create table schemafk2.table2 (table2_id integer primary key, table1_id 7 | integer, foreign key (table1_id) references schemafk1.table1); 8 | create table schemafk2.table3 (table3_id integer primary key, table1_id integer); 9 | alter table schemafk2.table3 add constraint fktbl3 foreign key (table1_id) 10 | references schemafk1.table1; 11 | create table schemafk2.table4 (table4_id integer primary key, table1_id integer); 12 | alter table schemafk2.table4 add constraint fktbl4 foreign key (table1_id) 13 | references schemafk1.table1 (table1_id); 14 | 15 | comment on table schemafk1.table1 is 'a short table comment'; 16 | comment on column schemafk1.table1.table1_id is 'a short column comment'; 17 | 18 | /*c2*/select * from information_schema.system_comments where object_schema='SCHEMAFK1' 19 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfSchemaPerCachTbl1.txt: -------------------------------------------------------------------------------- 1 | -- CREATE AND INITIALIZE CACHED TABLE OBJECTS 2 | 3 | -- This CREATES the schema-specific objects to be used for 4 | -- schema-specific persistence tests. 5 | 6 | 7 | -- ****************************** CACH Tables 8 | --DROP TABLE nosuch; 9 | DROP TABLE ctblt1 IF exists; 10 | DROP TABLE ctblt2 IF exists; 11 | DROP TABLE ctblt3 IF exists; 12 | DROP TABLE ctblt4 IF exists; 13 | DROP TABLE ctblt101 IF exists; 14 | DROP TABLE tblj1 IF exists; 15 | /*u0*/CREATE CACHED TABLE ctblt1 (i int); 16 | /*u0*/CREATE CACHED TABLE public.ctblt2 (i int); 17 | /*u0*/CREATE CACHED TABLE ctblt3 (i int); 18 | /*u0*/CREATE CACHED TABLE tblj1 (i int, vc varchar(10)); -- For testing Joins 19 | /*e*/CREATE CACHED TABLE information_schema.ctblt101 (i int); 20 | /*e*/CREATE CACHED TABLE ctblt1 (i int); -- Create existing object 21 | /*e*/CREATE CACHED TABLE public.ctblt1 (i int); -- Create existing object 22 | /*e*/CREATE CACHED TABLE information_schema.system_users (i int); -- Existing object 23 | /*e*/INSERT INTO other.ctblt1 values(0); 24 | /*e*/INSERT INTO information_schema.ctblt1 values(1); 25 | /*u1*/INSERT INTO ctblt1 values(0); 26 | /*u1*/INSERT INTO public.ctblt1 values(100); 27 | -- Test one update that will be persisted (most update tests won't be) 28 | /*u1*/UPDATE public.ctblt1 set i = 1 WHERE i = 100; 29 | /*u1*/INSERT INTO tblj1 values(1, 'one'); 30 | CREATE TABLE public.ctblt4 AS (SELECT * FROM public.ctblt1 WHERE i = 0) WITH DATA; 31 | /*c1*/SELECT * FROM public.ctblt4; 32 | -- Work-around 33 | ALTER TABLE ctblt1 ADD CONSTRAINT cpk_workaround PRIMARY KEY(i); 34 | 35 | -- ****************************** ALTERs 36 | -- Add tests when time permits. 37 | 38 | 39 | -- This to test recovery from .log files. 40 | SHUTDOWN IMMEDIATELY; 41 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfSchemaQuoting.txt: -------------------------------------------------------------------------------- 1 | -- Tests quoted schema names 2 | 3 | /*u0*/SET SCHEMA information_schema; 4 | /*u0*/CREATE SCHEMA sChEmA1 authorization sa; 5 | /*c1*/select * from schemata 6 | where schema_owner = 'SA' AND schema_name = 'SCHEMA1'; 7 | 8 | /*u0*/CREATE SCHEMA dEfAuLt1 authorization sa; 9 | /*c1*/select * from schemata 10 | where schema_name = 'DEFAULT1'; 11 | 12 | /*u0*/SET INITIAL SCHEMA "DEFAULT1"; 13 | /*c1*/SELECT * FROM system_users 14 | WHERE user_name = 'SA' AND initial_schema = 'DEFAULT1'; 15 | 16 | /*u0*/SET INITIAL SCHEMA DEFAULT; 17 | /*c1*/SELECT * FROM system_users 18 | WHERE user_name = 'SA' AND initial_schema IS NULL; 19 | 20 | /*u0*/CREATE SCHEMA "mIxEdCaSe" AUTHORIZATION sa; 21 | /*c1*/select * from schemata where schema_name = 'mIxEdCaSe'; 22 | /*u0*/CREATE TABLE "mIxEdCaSe".t1(i int); 23 | /*e*/DROP TABLE mIxEdCaSe.t1; 24 | /*u0*/DROP TABLE "mIxEdCaSe".t1; 25 | /*e*/DROP SCHEMA mIxEdCaSe; 26 | /*u0*/DROP SCHEMA "mIxEdCaSe"; 27 | 28 | /*u0*/CREATE USER u1 PASSWORD "u1"; 29 | /*u0*/CREATE SCHEMA "oThErMiXeD" authorization u1; 30 | /*u0*/CREATE TABLE "oThErMiXeD".t2(i int); 31 | /*e*/DROP SCHEMA oThErMiXeD CASCADE; 32 | /*u0*/DROP SCHEMA "oThErMiXeD" CASCADE; 33 | 34 | /*s*/DROP USER u1 CASCADE; 35 | /*s*/DROP USER u1; 36 | /*s*/DROP SCHEMA schema1 CASCADE; 37 | 38 | /*U0*/ Workaround for bug where DDL will not Commit 39 | /*s*/CREATE TABLE bug_workaround (i int); 40 | /*s*/INSERT INTO bug_workaround VALUES(1); 41 | /*u0*/SHUTDOWN; 42 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfSeqRightsB.txt: -------------------------------------------------------------------------------- 1 | -- $Id$ 2 | -- Test .log persistence of Sequence rights 3 | 4 | CONNECT USER blaine PASSWORD "b"; 5 | -- Following is default, but just to eliminate any ambiguity... 6 | SET SCHEMA public; 7 | -- By virtue of PUBLIC grants 8 | /*c1*/SELECT * FROM pt; 9 | /*e*/SELECT i, next value for ps9 FROM pt; 10 | /*e*/SELECT i, next value for public.ps9 FROM public.pt; 11 | /*e*/SELECT i, next value for ps9 FROM public.pt; 12 | /*c1*/SELECT i, next value for ps1 FROM pt; 13 | SET SCHEMA bsch; 14 | /*c1*/SELECT i, next value for public.ps2 FROM public.pt; 15 | -- Don't own - previously threw error but now adds a warning 16 | /*E*/GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; 17 | /*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; 18 | -- By virtue of schema ownership 19 | /*c1*/SELECT i, next value for bs2 FROM bt; 20 | SET SCHEMA public; 21 | /*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; 22 | -- Enough schema specification testing. Just use defauls Session schema for 23 | -- here on in 24 | /*c1*/SELECT i FROM pt; 25 | /*e*/SELECT i, next value for ps3 FROM pt; 26 | /*e*/SELECT i, next value for ps4 FROM pt; 27 | /*c1*/SELECT i, next value for ps5 FROM pt; 28 | /*c1*/SELECT i, next value for ps6 FROM pt; 29 | /*e*/SELECT i, next value for ps7 FROM pt; 30 | /*e*/SELECT i, next value for ps8 FROM pt; 31 | 32 | CONNECT USER sa PASSWORD ""; 33 | SHUTDOWN; 34 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfSeqRightsC.txt: -------------------------------------------------------------------------------- 1 | -- $Id$ 2 | -- Test .script persistence of Sequence rights 3 | 4 | CONNECT USER blaine PASSWORD "b"; 5 | -- Following is default, but just to eliminate any ambiguity... 6 | SET SCHEMA public; 7 | -- By virtue of PUBLIC grants 8 | /*e*/SELECT i, next value for ps9 FROM pt; 9 | /*e*/SELECT i, next value for public.ps9 FROM public.pt; 10 | /*e*/SELECT i, next value for ps9 FROM public.pt; 11 | /*c1*/SELECT i, next value for ps1 FROM pt; 12 | SET SCHEMA bsch; 13 | /*c1*/SELECT i, next value for public.ps2 FROM public.pt; 14 | -- Don't own - previously threw error but now adds a warning 15 | /*E*/GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; 16 | /*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; 17 | -- By virtue of schema ownership 18 | /*c1*/SELECT i, next value for bs2 FROM bt; 19 | SET SCHEMA public; 20 | /*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; 21 | -- Enough schema specification testing. Just use defauls Session schema for 22 | -- here on in 23 | /*c1*/SELECT i FROM pt; 24 | /*e*/SELECT i, next value for ps3 FROM pt; 25 | /*e*/SELECT i, next value for ps4 FROM pt; 26 | /*c1*/SELECT i, next value for ps5 FROM pt; 27 | /*c1*/SELECT i, next value for ps6 FROM pt; 28 | /*e*/SELECT i, next value for ps7 FROM pt; 29 | /*e*/SELECT i, next value for ps8 FROM pt; 30 | 31 | -- Test REVOKES 32 | -- Can't revoke on objects you don't own 33 | /*e*/REVOKE ALL ON SEQUENCE public.ps6 FROM public RESTRICT; 34 | /*u0*/REVOKE ALL ON SEQUENCE bsch.bs1 FROM public RESTRICT; 35 | CONNECT USER sa PASSWORD ""; 36 | /*u0*/REVOKE USAGE ON SEQUENCE public.ps6 FROM BLAINE RESTRICT; 37 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfTempTable1.txt: -------------------------------------------------------------------------------- 1 | /*s*/DROP tmptbl1 IF EXISTS; 2 | /*s*/DROP tmptbl2 IF EXISTS; 3 | /*s*/DROP user altuser1; 4 | /*s*/DROP user altuser2; 5 | 6 | CREATE USER altuser1 PASSWORD password; 7 | CREATE USER altuser2 PASSWORD password; 8 | /*u0*/GRANT CHANGE_AUTHORIZATION TO altuser1; 9 | /*u0*/GRANT CHANGE_AUTHORIZATION TO altuser2; 10 | /*u0*/CREATE TEMP TABLE tmptbl1 (i int); 11 | /*u0*/CREATE TEMP TABLE tmptbl2 (i int); 12 | /*u0*/GRANT ALL ON tmptbl1 TO altuser1; 13 | /*u0*/GRANT ALL ON tmptbl2 TO altuser1; 14 | SET AUTOCOMMIT false; 15 | /*u1*/INSERT INTO tmptbl1 VALUES(1); 16 | /*u1*/INSERT INTO tmptbl1 VALUES(2); 17 | /*c2*/SELECT * FROM tmptbl1; 18 | COMMIT; 19 | /*u1*/INSERT INTO tmptbl2 VALUES(1); 20 | /*u1*/INSERT INTO tmptbl2 VALUES(2); 21 | /*c0*/SELECT * FROM tmptbl1; 22 | /*c2*/SELECT * FROM tmptbl2; 23 | COMMIT; 24 | 25 | CONNECT USER altuser1 PASSWORD password; 26 | /*c0*/SELECT * FROM tmptbl1; 27 | /*c0*/SELECT * FROM tmptbl2; 28 | COMMIT; 29 | 30 | CONNECT USER altuser2 PASSWORD password; 31 | /*e*/SELECT * FROM tmptbl1; 32 | /*e*/SELECT * FROM tmptbl2; 33 | CONNECT USER SA password ""; 34 | SHUTDOWN IMMEDIATELY; 35 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfTempTable2.txt: -------------------------------------------------------------------------------- 1 | -- This script depends on TestSelfTempTable1.txt to set up the objects tested. 2 | 3 | SET AUTOCOMMIT false; 4 | /*c0*/SELECT * FROM tmptbl1; 5 | /*c0*/SELECT * FROM tmptbl2; 6 | COMMIT; 7 | CONNECT USER altuser2 PASSWORD password; 8 | /*e*/SELECT * FROM tmptbl1; 9 | /*e*/SELECT * FROM tmptbl2; 10 | CONNECT USER altuser1 PASSWORD password; 11 | /*c0*/SELECT * FROM tmptbl1; 12 | /*c0*/SELECT * FROM tmptbl2; 13 | /*u1*/INSERT INTO tmptbl1 VALUES(1); 14 | /*u1*/INSERT INTO tmptbl1 VALUES(2); 15 | /*c2*/SELECT * FROM tmptbl1; 16 | COMMIT; 17 | -- Purposefully not committing these inserts 18 | /*c0*/SELECT * FROM tmptbl1; 19 | /*u1*/INSERT INTO tmptbl2 VALUES(1); 20 | /*u1*/INSERT INTO tmptbl2 VALUES(2); 21 | /*c2*/SELECT * FROM tmptbl2; 22 | ROLLBACK; 23 | CONNECT USER SA password ""; 24 | SHUTDOWN; 25 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfTrimSimplified.txt: -------------------------------------------------------------------------------- 1 | -- TestSelfTrimSimplified.txt 2 | -- 3 | -- trim looks different 4 | 5 | 6 | drop table testtable if exists cascade; 7 | create cached table testtable ( 8 | aString varchar(256) not null, 9 | firstNum integer not null, 10 | aDate date not null, 11 | secondNum integer not null, 12 | thirdNum integer not null, 13 | aName varchar(32) not null 14 | ); 15 | 16 | insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) 17 | values (' XYZ ', 22, '2003-11-10', 18, 3, 'my name goes here'); 18 | 19 | /*rXYZ*/select trim(aString) from testtable; 20 | drop table testtable; 21 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfUserFunction.txt: -------------------------------------------------------------------------------- 1 | -- 2 | -- TestSelfUserFunction.txt 3 | -- 4 | -- This test checks if the USER() function works correctly when used within 5 | -- prepared statements such as VIEW's and constraints in TABLE's 6 | 7 | -- Setup tables and views 8 | DROP TABLE USER_PROFILE IF EXISTS 9 | CREATE TABLE USER_PROFILE(NAME VARCHAR(10), PROFILE INT) 10 | DROP VIEW USER_SECURITY_PROFILE_VIEW IF EXISTS 11 | CREATE VIEW USER_SECURITY_PROFILE_VIEW AS SELECT * FROM USER_PROFILE WHERE Name = USER() 12 | 13 | -- Create user for test 14 | CREATE USER MATT PASSWORD MATT ADMIN 15 | 16 | -- This checks that you are allowed to insert a row as long as your username matches the NAME field 17 | /*u1*/ INSERT INTO USER_PROFILE(NAME, PROFILE) VALUES('SA',10) 18 | 19 | -- Connect as MATT 20 | CONNECT USER MATT PASSWORD MATT 21 | 22 | -- Insert a row as the connected user 23 | /*u1*/ INSERT INTO USER_PROFILE(NAME, PROFILE) VALUES('MATT',20) 24 | 25 | -- There are two rows in the table but the select should only return the row 26 | -- associated with the connected user i.e. one row 27 | /*c1*/ SELECT COUNT(*) FROM USER_SECURITY_PROFILE_VIEW 28 | SHUTDOWN 29 | 30 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestSelfVerify.txt: -------------------------------------------------------------------------------- 1 | -- 2 | -- TestSelfVerify.txt 3 | -- 4 | -- This is part of a three part suite of scripts to test persistence in the same DB 5 | 6 | -- Correct handling of index creation for foreign keys 7 | -- check the consistency of foreign keys and primary keys 8 | /*e*/create table VEREIN(VCODE CHAR(10) not null); 9 | /*e*/create table BEWERB(VCODE CHAR(10) not null, ID SMALLINT not null); 10 | /*e*/create unique index BEWERB_FK1 on BEWERB(VCODE); 11 | /*e*/alter table BEWERB add constraint bv foreign key (VCODE) references VEREIN (VCODE); 12 | 13 | -- fails as a uique indexes on verein and bewerb exist 14 | /*e*/create unique index VEREIN_PK on VEREIN (VCODE); 15 | /*e*/create unique index BEWERB_FK2 on BEWERB(ID); 16 | 17 | -- null value in not null column 18 | /*e*/insert into verein values (null); 19 | -- referential no matching row 20 | /*e*/insert into bewerb values ('aaaaaaa',18); 21 | -- duplicate row 22 | /*e*/insert into bewerb values ('hijklmn',7); 23 | -- referential integrity row has reference 24 | /*e*/delete from verein where vcode='opqrstu' 25 | 26 | --test identity increment 27 | INSERT INTO APP2 (VALUE) VALUES(13); 28 | INSERT INTO APP2 (VALUE) VALUES(14); 29 | 30 | /*r5,14*/ SELECT COUNT(ID), MAX(VALUE) FROM APP2 31 | 32 | --test persistence of insert into operations 33 | /*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Eran'; 34 | /*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Shelly'; 35 | /*c4*/SELECT * FROM NEWAPP; 36 | 37 | --test correct persistent of view defined in TestSelfCreate.txt 38 | /*r 39 | 14,newdir,NULL 40 | */select * from "View" 41 | 42 | /*r 43 | 14,newdir,NULL 44 | */select * from "View2" 45 | 46 | --test INSERT .. INTO and indexes 47 | create cached table bewerb_copy as (select * from bewerb) with data; 48 | create index idx_bewerb_copy on bewerb_copy(VCODE,ID); 49 | 50 | /*u0*/SHUTDOWN; 51 | 52 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestText01.txt: -------------------------------------------------------------------------------- 1 | -- all_quoted 2 | drop table tmain if exists; 3 | create table tmain(c1 varchar(10),i1 integer, c2 varchar(10)); 4 | insert into tmain values(null, null, null); 5 | insert into tmain values('aval1', null, 'aval2'); 6 | drop table t if exists; 7 | create text table t(c1 varchar(10),i1 integer, c2 varchar(10)); 8 | set table t source "t.txt; all_quoted=true;ignore_first=true"; 9 | set table t source header """charcol_1"",""intcol"",""charcol_2"""; 10 | insert into t select * from tmain; 11 | -- unquoted 12 | create table ttmain(doublequote char(10), singlequote char(10)); 13 | insert into ttmain values('noquoteA', 'noquoteB'); 14 | insert into ttmain values('"inch','''foot'); 15 | insert into ttmain values('_""_','_''''_' ); 16 | insert into ttmain values('"quoted"','''quoted'''); 17 | insert into ttmain values('inch"','foot'''); 18 | insert into ttmain values('"inch"','''foot'''); 19 | create text table tt(doubquote char(10), singquote char(10)); 20 | set table tt source "tt.txt;quoted=false;fs=\t;ignore_first=true"; 21 | set table tt source header "DOUBQUOTE,SINGQUOTE"; 22 | insert into tt select * from ttmain; 23 | -- identity test 24 | drop table tident if exists; 25 | create text table tident(c1 int generated by default as identity, c2 varchar(20)); 26 | set table tident source "tident.txt; all_quoted=true;ignore_first=true"; 27 | set table tident source header """IDENT"",""VAL"""; 28 | -- single column test 29 | drop table tsingle if exists; 30 | create text table tsingle(c1 int); 31 | set table tsingle source "tsingle.txt;ignore_first=true"; 32 | set table tsingle source header 'full history'; 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestText02.txt: -------------------------------------------------------------------------------- 1 | /*c2*/SELECT * FROM TMAIN; 2 | /*c0*/SELECT * FROM TMAIN EXCEPT SELECT * FROM T; 3 | /*c0*/SELECT * FROM T EXCEPT SELECT * FROM TMAIN; 4 | /*c6*/SELECT * FROM TTMAIN; 5 | /*c0*/SELECT * FROM TT EXCEPT SELECT * FROM TTMAIN; 6 | /*c0*/SELECT * FROM TTMAIN EXCEPT SELECT * FROM TT; 7 | -------------------------------------------------------------------------------- /testrun/hsqldb/TestTriggers.txt: -------------------------------------------------------------------------------- 1 | drop table testtrig if exists; 2 | create cached table testtrig(c1 integer generated by default as identity, c2 varchar(40), c3 integer); 3 | create trigger tbir before insert on testtrig referencing new row as newrow 4 | for each row when (newrow.c2 is not null) 5 | call "org.hsqldb.test.TriggerClass"; 6 | create trigger tair after insert on testtrig referencing new row as newrow 7 | for each row when (newrow.c2 is not null) 8 | call "org.hsqldb.test.TriggerClass"; 9 | create trigger tais after insert on testtrig 10 | for each statement 11 | call "org.hsqldb.test.TriggerClass"; 12 | create trigger tbur before update of c1, c2, c3 on testtrig referencing new row as newrow 13 | for each row when (newrow.c2 is not null) 14 | call "org.hsqldb.test.TriggerClass"; 15 | create trigger taur after update on testtrig referencing new row as newrow 16 | for each row when (newrow.c2 is not null) 17 | call "org.hsqldb.test.TriggerClass"; 18 | create trigger taus after update on testtrig 19 | for each statement 20 | call "org.hsqldb.test.TriggerClass"; 21 | create trigger tbdr before delete on testtrig referencing old row as oldrow 22 | for each row when (oldrow.c2 is not null) 23 | call "org.hsqldb.test.TriggerClass"; 24 | create trigger tadr after delete on testtrig referencing old row as oldrow 25 | for each row when (oldrow.c2 is not null) 26 | call "org.hsqldb.test.TriggerClass"; 27 | create trigger tads after delete on testtrig 28 | for each statement 29 | call "org.hsqldb.test.TriggerClass"; 30 | -------------------------------------------------------------------------------- /testrun/sqltool/adv-comments.sql: -------------------------------------------------------------------------------- 1 | /* The tests in this file don't succeed with SqlTool as it is now due to: 2 | * Improper handling of traditional-comments inside single-line comment. 3 | * Improper handling of single-line comments inside traditional comment. 4 | * Inability to recognize SQL commands on lines which don't end with ;\s*$. 5 | */ 6 | 7 | /* Repeat with text right up to edges/* /*on one*/ /*line*/ 8 | /*Same thing/* /*with leading*/ /*+ trailing white space*/ 9 | 10 | 11 | CREATE TABLE t(i int); 12 | INSERT INTO t VALUES(1); 13 | INSERT INTO t VALUES(2); 14 | 15 | SELECT * FROM t; -- single-line SQL-trailing comment 16 | * if (*? != 2) \q Hyphen-hyphen trailing SQL failed 17 | SELECT * FROM t; /* traditional SQL-trailing comment */ 18 | * if (*? != 2) \q Traditional trailing SQL failed 19 | 20 | SELECT * FROM t; /* Something -- single-line SQL-trailing comment */ 21 | * if (*? != 2) \q Hyphen-hyphen trailing SQL failed 22 | -------------------------------------------------------------------------------- /testrun/sqltool/altspace.targtbl.dsv: -------------------------------------------------------------------------------- 1 | i|vc 2 | 11|eleven 3 | 12|twelve 4 | -------------------------------------------------------------------------------- /testrun/sqltool/append.inter: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests interactive commands :a*. 5 | */ 6 | 7 | \c false 8 | /* Since running interactively, need to either invoke with --abortOnErr switch, 9 | * or use "\c false" Special command, to detect failures. */ 10 | 11 | CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); 12 | INSERT INTO t (vc) VALUES('a'); 13 | INSERT INTO t (vc) VALUES('b'); 14 | INSERT INTO t (vc) VALUES('c'); 15 | INSERT INTO t (vc) VALUES('b'); 16 | 17 | SELECT count(*) FROM t 18 | *if (*? != 4) \q Sanity check failed / 1 19 | 20 | SELECT count(*) FROM t WHERE vc = 'b'; 21 | *if (*? != 2) \q Sanity check failed / 2 22 | 23 | INSERT INTO t(vc) VALUES 24 | 25 | :a ('prefpost'); 26 | 27 | SELECT count(*) FROM t 28 | *if (*? != 5) \q Append + repl failed / 1 29 | 30 | SELECT vc FROM t; 31 | SELECT count(*) FROM t WHERE vc = 'prefpost'; 32 | *if (*? != 1) \q Append + repl failed / 2 33 | 34 | SELECT count(*) FROM t; 35 | 36 | \p Intervening command making previous become command # -2. 37 | :h 38 | :-2a WHERE vc = 'b'; 39 | 40 | *if (*? != 2) \q Recall + Append + exec failed / 1 41 | 42 | :-1 43 | :a AND 44 | id 45 | = 1 46 | 47 | :; 48 | *if (*? != 1) \q Recall + multi-line Append failed / 1 49 | -------------------------------------------------------------------------------- /testrun/sqltool/at-chainer.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * This script invokes the script subdir/atuser.sql, in normal fashion, to 5 | * test that @ works when used by a sub-script. 6 | */ 7 | 8 | \i subdir/atuser.sql 9 | -------------------------------------------------------------------------------- /testrun/sqltool/badsqlonly.nsql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Simplest test possible. Does absolutely nothing. 5 | */ 6 | 7 | /** Intentional SQL syntax error here */ 8 | CREATE FABLE t(i INTEGER); 9 | 10 | \p Should never reach here. 11 | -------------------------------------------------------------------------------- /testrun/sqltool/buffer-vars.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | 5 | CREATE TABLE t (i INT, a INT, d DATE); 6 | 7 | INSERT INTO t(i, a, d) VALUES (1, 149, null); 8 | 9 | -- 1-liner sanity check: 10 | * qpart1 = i FROM 11 | SELECT *{qpart1} t; 12 | * if (*? != 1) \q 1-line query with internal PL variable failed 13 | 14 | -- Multi-line PL var: 15 | \. 16 | a 17 | FROM 18 | . 19 | * qpart2 : 20 | SELECT *{qpart2} t; 21 | * if (*? != 149) \q 1-line query with multi-line internal PL variable failed 22 | 23 | * res1 ~ 24 | SELECT 25 | *{qpart2} 26 | t; 27 | * if (*res1 != 149) 28 | \q multi-line query with multi-line internal PL variable failed 29 | * end if 30 | 31 | -- Multi-line Macro: 32 | \. 33 | SELECT 34 | a 35 | . 36 | /= m1 : FROM 37 | * res2 ~ 38 | /m1 t; 39 | * if (*res2 != 149) 40 | \q Legacy multi-line query with multi-line internal PL variable failed 41 | * end if 42 | 43 | -- Newer syntax of same: 44 | \. 45 | SELECT 46 | a 47 | . 48 | -- Note the critical 2 spaces before FROM to delimite it from preceding token: 49 | /: m1 FROM 50 | * res3 ~ 51 | /m1 t; 52 | * if (*res3 != 149) 53 | \q multi-line query with multi-line internal PL variable failed. Ws by appendage. 54 | * end if 55 | 56 | -- With separating white space in in middle appendage 57 | \. 58 | a 59 | FROM 60 | . 61 | * qpart3 : 62 | SELECT *{qpart3}t; 63 | * if (*? != 149) \q White space inserted with middle appendage 64 | 65 | -- With separating white space in the base 66 | \. 67 | a 68 | FROM 69 | . 70 | * qpart3 : 71 | SELECT *{qpart3}t; 72 | * if (*? != 149) \q White space inserted with middle appendage 73 | -------------------------------------------------------------------------------- /testrun/sqltool/build.gradle: -------------------------------------------------------------------------------- 1 | defaultTasks 'runTests' 2 | 3 | task runTests << { 4 | def params = ['NO_JVM_EXIT'] 5 | boolean verbose = 6 | project.hasProperty('verbose') && project.property('verbose') 7 | if (verbose) params << '-v' 8 | if (project.hasProperty('norun') && project.property('norun')) 9 | params << '-n' 10 | if (project.hasProperty('scripts')) 11 | params.addAll(project.property('scripts').split(',')) 12 | if (!verbose) System.console().writer().print(' ') 13 | run(new File('runtests.groovy'), params as String[]) 14 | } 15 | -------------------------------------------------------------------------------- /testrun/sqltool/csv-1charquoted.csv: -------------------------------------------------------------------------------- 1 | ID,A,B 2 | 1,"A1","B1" 3 | 2,"A2","B2" 4 | 3,"A3","B3" 5 | -------------------------------------------------------------------------------- /testrun/sqltool/csv-1charquoted.sql: -------------------------------------------------------------------------------- 1 | -- Tests HSQLDB bug 3615035 2 | 3 | * *DSV_COL_DELIM = , 4 | * *DSV_COL_SPLITTER = , 5 | -- * *DSV_REJECT_REPORT = import.html 6 | * *NULL_REP_TOKEN = 7 | * *DSV_TARGET_TABLE=t 8 | 9 | CREATE TABLE T (ID INTEGER PRIMARY KEY NOT NULL, A VARCHAR(2), B VARCHAR(2)); 10 | COMMIT; 11 | 12 | \mq csv-1charquoted.csv 13 | COMMIT; 14 | -------------------------------------------------------------------------------- /testrun/sqltool/csv-quotedcolheaders.csv: -------------------------------------------------------------------------------- 1 | "field1","field2","field3","field4" 2 | "skiing","climbing","swimming","playing" 3 | "skiing","climbing","swimming","playing" 4 | "skiing","climbing","swimming","playing" 5 | "skiing","climbing","swimming","playing" 6 | "skiing","climbing","swimming","playing" 7 | "skiing","climbing","swimming","playing" 8 | "skiing","climbing","swimming","playing" 9 | "skiing","climbing","swimming","playing" 10 | -------------------------------------------------------------------------------- /testrun/sqltool/csv-quotedcolheaders.sql: -------------------------------------------------------------------------------- 1 | -- Simplification of test case submitted by tokajac 2 | 3 | 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)); 4 | * *DSV_TARGET_TABLE = tmp_tbl 5 | * *DSV_COL_SPLITTER=, 6 | \mq csv-quotedcolheaders.csv 7 | commit; 8 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-abortcommits.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests proper commit behavior upon DSV abortion 5 | */ 6 | 7 | CREATE TABLE t (i INT, r REAL, d DATE, t TIMESTAMP, v VARCHAR(80), b BOOLEAN); 8 | 9 | \c true 10 | 11 | \a true 12 | \m dsv-rejects.dsv 13 | SELECT COUNT(*) FROM t; 14 | *if (*? != 1) \q Should have imported 1 good DSV records, but imported *{?} (1) 15 | ROLLBACK; 16 | SELECT COUNT(*) FROM t; 17 | *if (*? != 1) 18 | \q Should have retained 1 DSV record after ROLLBACK w/autocommit, but retained *{?} 19 | *end if 20 | 21 | -- Now with auto-commit off 22 | \a false 23 | DELETE FROM t; 24 | COMMIT; 25 | \m dsv-rejects.dsv 26 | SELECT COUNT(*) FROM t; 27 | *if (*? != 1) \q Should have imported 1 good DSV records, but imported *{?} (2) 28 | ROLLBACK; 29 | SELECT COUNT(*) FROM t; 30 | *if (*? != 0) 31 | \q Should have retained 0 DSV record after ROLLBACK, but retained *{?} 32 | *end if 33 | 34 | DELETE FROM t; 35 | COMMIT; 36 | * *DSV_RECORDS_PER_COMMIT = 10 37 | \m dsv-rejects.dsv 38 | SELECT COUNT(*) FROM t; 39 | *if (*? != 1) \q Should have imported 1 good DSV records, but imported *{?} (3) 40 | ROLLBACK; 41 | SELECT COUNT(*) FROM t; 42 | *if (*? != 1) 43 | \q Should have retained 1 DSV record after ROLLBACK w/RPC, but retained *{?} 44 | *end if 45 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-altspace.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests importing to table in non-default tablespace 5 | */ 6 | 7 | CREATE SCHEMA altspace authorization dba; 8 | CREATE TABLE altspace.targtbl (i INT, vc VARCHAR(80)); 9 | 10 | \m altspace.targtbl.dsv 11 | SELECT COUNT(*) FROM altspace.targtbl; 12 | 13 | *if (*? != 2) \q Import to alternate tablespace failed 14 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-constcols.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | 3 | # Following (header) line has intentional trailing whitespace. 4 | i | - | d 5 | 6 | # Following line has intentional trailing whitespace (and mixed case). 7 | 1 | 1 | 2006-12-11 8 | 2 | 2 | 9 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-constcols.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests setting column values with *DSV_CONST_COLS 5 | */ 6 | 7 | * *DSV_CONST_COLS= d = 2007-05-14 0:00:00 | a = 139 8 | 9 | CREATE TABLE t (i INT, a INT, d DATE); 10 | 11 | \m dsv-constcols.dsv 12 | SELECT COUNT(*) FROM t WHERE a = 139 AND d = '2007-05-14'; 13 | 14 | /* The d const value will override the .dsv-specified values. */ 15 | *if (*? != 2) \q Import using constants for int and date columns failed 16 | 17 | DELETE from t; 18 | * *DSV_CONST_COLS= 19 | \m dsv-constcols.dsv 20 | 21 | SELECT COUNT(*) FROM t WHERE a IS null AND d IS null; 22 | *if (*? != 1) \q Failed to reset CONST_COLS behavior (1) 23 | 24 | SELECT COUNT(*) FROM t WHERE a IS null AND d = '2006-12-11'; 25 | *if (*? != 1) \q Failed to reset CONST_COLS behavior (2) 26 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-multiline.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Does a DSV export using a multi-line custom query instead of just 5 | * specifying the table name. 6 | * Imports it back to validate the output. 7 | */ 8 | 9 | * *DSV_TARGET_FILE = ${java.io.tmpdir}/test-roundtrip-${user.name}.dsv 10 | * *DSV_TARGET_TABLE = t 11 | CREATE TABLE t (i INT, a INT, d DATE); 12 | 13 | INSERT INTO t(i, a, d) VALUES (1, 149, null); 14 | INSERT INTO t(i, a, d) VALUES (2, null, '2007-06-24'); 15 | 16 | \. 17 | SELECT 18 | * FROM 19 | t 20 | . 21 | 22 | /* Export */ 23 | \x : WHERE i = 1 24 | 25 | SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; 26 | *if (*? != 1) \q Pre-check of inserted data failed (1) 27 | SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; 28 | *if (*? != 1) \q Pre-check of inserted data failed (2) 29 | 30 | 31 | /* Import */ 32 | \m *{*DSV_TARGET_FILE} 33 | 34 | SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; 35 | *if (*? != 2) \q Post-check of imported data failed (1) 36 | SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; 37 | *if (*? != 1) \q Post-check of imported data failed (2) 38 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-omits.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | 3 | # Following (header) line has intentional trailing whitespace. 4 | - | i | - | a | - | b | - | c 5 | 6 | # Following line has intentional trailing whitespace (and mixed case). 7 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 8 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 9 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-omits.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id: dsv-omits.sql$ 3 | * 4 | * Tests omitting columns via header line and *DSV_SKIP_COLS 5 | */ 6 | 7 | CREATE TABLE t (i INT, a INT, b INT, c INT); 8 | 9 | \m dsv-omits.dsv 10 | SELECT COUNT(*) FROM t 11 | WHERE i IS NOT null AND a IS NOT null AND b IS NOT null AND c IS NOT null; 12 | 13 | *if (*? != 2) \q Import using header line - column-skips failed 14 | 15 | /** Repeat test with some non-default DSV settings */ 16 | * *DSV_SKIP_COLS = c| a 17 | 18 | DELETE FROM t; 19 | \m dsv-omits.dsv 20 | 21 | SELECT COUNT(*) FROM t 22 | WHERE i IS NOT null AND b IS NOT null AND a IS null AND c IS null; 23 | 24 | *if (*? != 2) 25 | \q Import using header line - AND *DSV_SKIP_COLS column-skips failed 26 | *end if 27 | 28 | /* Now test that behavior reverts when PL variable is cleared */ 29 | * *DSV_SKIP_COLS = 30 | * listvalues 31 | 32 | DELETE FROM t; 33 | \m dsv-omits.dsv 34 | SELECT COUNT(*) FROM t 35 | WHERE i IS NOT null AND a IS NOT null AND b IS NOT null AND c IS NOT null; 36 | \p Post everything 37 | 38 | *if (*? != 2) 39 | SELECT * FROM t; 40 | \q *DSV_SKIP_COLS behavior failed to revert when variable was cleared 41 | *end if 42 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-prepare.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests PL 'prepare' command 5 | */ 6 | 7 | CREATE TABLE t (i INT, a INT, b INT, c INT); 8 | 9 | * N = 4567 10 | * prepare N 11 | 12 | INSERT INTO t(i, a, b, c) VALUES (1, ?, 8, 9); 13 | 14 | SELECT count(*) FROM t WHERE i = 1 AND a = 4567 AND b= 8 AND c = 9; 15 | 16 | *if (*? != 1) \q PL prepare command failed 17 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-rejects.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | 3 | i | r | d | t | v | b 4 | 5 | 31 | 3.124 | 2007-06-07 | 2006-05-06 12:30:04 | a B | true 6 | 42 | 1.5 | 2007-07-08 | 2006-05-07 10:20 | a string | false 7 | 8 | # Letter in int field: 9 | 5 | a | 2007-07-08 | 2006-05-07 10:20 | a string | false 10 | 11 | # No seconds in time field 12 | 42 | 1.5 | 2007-07-08 | 2006-05-07 10:20 | a string | false 13 | 14 | 42 | 1.5 | 2007-07-08 | 2006-05-07 10:20:0 | a string | false 15 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-rejects.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests proper rejection of bad DSV input records 5 | */ 6 | 7 | CREATE TABLE t (i INT, r REAL, d DATE, t TIMESTAMP, v VARCHAR(80), b BOOLEAN); 8 | 9 | * *DSV_REJECT_REPORT = ${java.io.tmpdir}/sqltoolutst-${user.name}.html 10 | \m dsv-rejects.dsv 11 | 12 | SELECT COUNT(*) FROM t; 13 | 14 | *if (*? != 2) \q Should have imported 2 good DSV records, but imported *{?} 15 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-roundtrip.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests a DSV "round trip". 5 | * Create a table, export the data, import it back, cf. imported and original. 6 | */ 7 | 8 | * *DSV_TARGET_FILE = ${java.io.tmpdir}/test-roundtrip-${user.name}.dsv 9 | * *DSV_TARGET_TABLE = t 10 | CREATE TABLE t (i INT, a INT, d DATE); 11 | 12 | INSERT INTO t(i, a, d) VALUES (1, 149, null); 13 | INSERT INTO t(i, a, d) VALUES (2, null, '2007-06-24'); 14 | 15 | /* Export */ 16 | \x t 17 | 18 | SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; 19 | *if (*? != 1) \q Pre-check of inserted data failed (1) 20 | SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; 21 | *if (*? != 1) \q Pre-check of inserted data failed (2) 22 | 23 | 24 | /* Import */ 25 | \m *{*DSV_TARGET_FILE} 26 | 27 | SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; 28 | *if (*? != 2) \q Post-check of imported data failed (1) 29 | SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; 30 | *if (*? != 2) \q Post-check of imported data failed (2) 31 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-rpcommit.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | 3 | i 4 | 1 5 | 2 6 | 3 7 | 4 8 | 5 9 | 6 10 | 7 11 | 8 12 | 9 13 | 10 14 | 11 15 | 12 16 | 13 17 | x 18 | 15 19 | 16 20 | 17 21 | 18 22 | 19 23 | 20 24 | 21 25 | 22 26 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-rpcommit.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests *DSV_RECORDS_PER_COMMIT setting 5 | */ 6 | 7 | /* Unfortunately, can't test how many commits are performed and where. 8 | * That would * require adding significant complexity to SqlFile itself, or 9 | * complex interception of commits. 10 | * I have, however, manually tested the commits by echoing the commits in 11 | * the source code, and removing observing what remains uncommitted after 12 | * removing the straggler-catching commit after the insertion loop in 13 | * SqlFile.importDsv(). 14 | * All that we are testing here is that all records which should be committed 15 | * do get committed. 16 | */ 17 | 18 | CREATE TABLE t (i INT); 19 | 20 | \c true 21 | * *DSV_RECORDS_PER_COMMIT=5 22 | \m dsv-rpcommit.dsv 23 | 24 | ROLLBACK; 25 | 26 | SELECT COUNT(*) FROM t; 27 | *if (*? != 13) \q *DSV_RECORDS_PER_COMMIT committed only *{?} records instead 13 28 | 29 | DELETE FROM t; 30 | * *DSV_REJECT_REPORT = ${java.io.tmpdir}/test-rpcommit-${user.name}.dsv 31 | \m dsv-rpcommit.dsv 32 | 33 | SELECT COUNT(*) FROM t; 34 | *if (*? != 21) \q *DSV_RECORDS_PER_COMMIT committed only *{?} records instead 21 35 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-sqlarray.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests a DSV "round trip". 5 | * Create a table, export the data, import it back, cf. imported and original. 6 | */ 7 | 8 | * *DSV_TARGET_FILE = ${java.io.tmpdir}/test-sqlarray-${user.name}.dsv 9 | * *DSV_TARGET_TABLE = t 10 | 11 | CREATE TABLE t (i BIGINT PRIMARY KEY, ar INTEGER ARRAY); 12 | 13 | INSERT INTO t VALUES (1, array [11, null, 13]); 14 | INSERT INTO t VALUES (2, null); 15 | INSERT INTO t VALUES (3, array [21, 22]); 16 | COMMIT; 17 | 18 | /* Export */ 19 | \x t 20 | 21 | SELECT count(*) FROM t WHERE ar IS NULL AND i = 2; 22 | *if (*? != 1) \q Pre-check of inserted Array array data failed (1) 23 | SELECT count(*) FROM t WHERE i in (1, 3) AND ar IS NOT null; 24 | *if (*? != 2) \q Pre-check of inserted Array data failed (2) 25 | 26 | DELETE FROM t; 27 | 28 | SELECT count(*) FROM t; 29 | *if (*? != 0) \q Failed to clear table data 30 | 31 | /* Import */ 32 | \m *{*DSV_TARGET_FILE} 33 | SELECT count(*) FROM t WHERE ar IS NULL AND i = 2; 34 | *if (*? != 1) \q Post-check of inserted Array array data failed (1) 35 | SELECT count(*) FROM t WHERE i in (1, 3) AND ar IS NOT null; 36 | *if (*? != 2) \q Post-check of inserted Array data failed (2) 37 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-trimall.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | i | vc | d 3 | 1 | o n e | 2006-12-11 4 | 2 | two | 2008-02-28 5 | 3|three| 6 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-trimall.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests *DSV_TRIM_ALL option. 5 | */ 6 | 7 | CREATE TABLE t (i INT, vc VARCHAR(80), d DATE); 8 | 9 | \m dsv-trimall.dsv 10 | 11 | SELECT COUNT(*) FROM t WHERE vc = 'three'; 12 | *if (*? != 1) \q Sanity check failed 13 | SELECT COUNT(*) FROM t WHERE vc = ' o n e '; 14 | *if (*? != 1) \q Default mode messed with VARCHAR-embedded whitespace 15 | SELECT COUNT(*) FROM t WHERE vc = ' two '; 16 | *if (*? != 1) 17 | \q Default mode messed with leading or trailing whitespace in VARCHAR 18 | *end if 19 | 20 | DELETE from t; 21 | COMMIT; 22 | 23 | * *DSV_TRIM_ALL = true 24 | 25 | \m dsv-trimall.dsv 26 | 27 | SELECT COUNT(*) FROM t WHERE vc = 'three'; 28 | *if (*? != 1) \q 2nd Sanity check failed 29 | SELECT COUNT(*) FROM t WHERE vc = 'o n e'; 30 | *if (*? != 1) 31 | \q *DSV_TRIM_ALL didn't trim with VARCHAR-embedded whitespace properly 32 | *end if 33 | SELECT COUNT(*) FROM t WHERE vc = 'two'; 34 | *if (*? != 1) 35 | \q *DSV_TRIM_ALL didn't trim leading or trailing whitespace properly 36 | *end if 37 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-trimming-alt.dsv: -------------------------------------------------------------------------------- 1 | targettable=t} 2 | } 3 | # Following (header) line has intentional trailing whitespace.} 4 | i \ r \ d \ t \ v \ b } 5 | } 6 | # Following line has intentional trailing whitespace (and mixed case).} 7 | 31 \ 3.124 \ 2007-06-07 \ 2006-05-06 12:30:04 \ a B \ tRUe } 8 | -------------------------------------------------------------------------------- /testrun/sqltool/dsv-trimming.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | 3 | # Following (header) line has intentional trailing whitespace. 4 | i | r | d | t | v | b 5 | 6 | # Following line has intentional trailing whitespace (and mixed case). 7 | 31 | 3.124 | 2007-06-07 | 2006-05-06 12:30:04 | a B | tRUe 8 | -------------------------------------------------------------------------------- /testrun/sqltool/else.sql: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests else statement 3 | */ 4 | 5 | * RES={ 6 | * EXPECTED={ c c23 A c24 A c c23 B c24 B d } 7 | * if (0) 8 | \q a 9 | \q b 10 | * else 11 | * foreach x (A B) 12 | * RES=*{RES} c 13 | * if (0) \q c1 14 | * if (0) 15 | \q c21 *{x} 16 | \q c22 *{x} 17 | * else 18 | * RES=*{RES} c23 *{x} 19 | * RES=*{RES} c24 *{x} 20 | * end if 21 | * end foreach 22 | * RES=*{RES} d 23 | * end if 24 | * RES=*{RES} } 25 | 26 | * if (*RES != *EXPECTED) \q (*{RES}) vs. (*{EXPECTED}) 27 | -------------------------------------------------------------------------------- /testrun/sqltool/errhandling.isql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests error handling inside of blocks and in subscripts. 5 | */ 6 | 7 | \c true 8 | bad; 9 | \p Made it past first ignored error. 10 | 11 | /* At root level, can even ignore fatal syntax errors */ 12 | * foreach bad 13 | * ifff 14 | 15 | * V = changethis 16 | * if (1) 17 | bad; 18 | * ifff 19 | * end nosuch 20 | * V = ok 21 | * end if 22 | 23 | * if (*V != ok) 24 | \q Seems to have aborted inside if block in Continue-on-error mode 25 | * end if 26 | 27 | * W = changethis 28 | * if (1) 29 | bad; 30 | *if (2) 31 | * ifff 32 | * end nosuch 33 | * W = ok 34 | *end if 35 | worse; 36 | * end if 37 | 38 | * if (*W != ok) 39 | \q Seems to have aborted inside nested if block in Continue-on-error mode 40 | * end if 41 | -------------------------------------------------------------------------------- /testrun/sqltool/errhandling.nsql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Negative tests error handling inside of blocks and in subscripts. 5 | */ 6 | 7 | * if (1) 8 | *if (2) \i errhandlingn.isql 9 | worse; 10 | * end if 11 | 12 | \p Returned from bad script errhandlingn.isql. Should not have. 13 | \q 14 | -------------------------------------------------------------------------------- /testrun/sqltool/errhandling.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests error handling inside of blocks and in subscripts. 5 | */ 6 | 7 | \c true 8 | bad; 9 | \p Made it past first ignored error. 10 | 11 | /* At root level, can even ignore fatal syntax errors */ 12 | * foreach bad 13 | * ifff 14 | 15 | * V = changethis 16 | * if (1) 17 | bad; 18 | * ifff 19 | * end nosuch 20 | * V = ok 21 | * end if 22 | 23 | * if (*V != ok) 24 | \q Seems to have aborted inside if block in Continue-on-error mode 25 | * end if 26 | 27 | * W = changethis 28 | * if (1) 29 | bad; 30 | *if (2) 31 | * ifff 32 | * end nosuch 33 | * W = ok 34 | *end if 35 | worse; 36 | * end if 37 | 38 | * if (*W != ok) 39 | \q Seems to have aborted inside nested if block in Continue-on-error mode 40 | * end if 41 | 42 | \i errhandling.isql 43 | -------------------------------------------------------------------------------- /testrun/sqltool/errhandlingn.isql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Errors out in a nested block 5 | */ 6 | 7 | * if (1) 8 | *if (2) \q Forced error 9 | worse; 10 | * end if 11 | 12 | \p Returned from bad block. Should not have. 13 | \q 14 | -------------------------------------------------------------------------------- /testrun/sqltool/for.sql: -------------------------------------------------------------------------------- 1 | * RES= { 2 | * 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 } 3 | * x = 0 4 | * for (*x < 3) ((x += 1)) 5 | * RES = *{RES} outerA *{x} 6 | * for ((y =1)) (*y < 3) ((y += 1)) 7 | * RES = *{RES} innerA *{x} *{y} 8 | * end for 9 | * end for 10 | 11 | * for ((x =1)) (*x < 3) ((x += 1)) 12 | * RES = *{RES} outerB *{x} 13 | * for ((y = 0)) (*y < *x) ((y += 1)) 14 | * RES = *{RES} innerB *{x} *{y} 15 | * end for 16 | * end for 17 | * RES = *{RES} } 18 | 19 | * if (*RES != *EXPECTED) \q (*{RES}) != (*{EXPECTED}) 20 | 21 | * ((summer = 0)) 22 | * for ((i = 0)) (*i < 10) ((i += 1)) 23 | * ((summer += i)) 24 | * end for 25 | * if (*summer != 45) \q Summation failed. *{summer} != 45 26 | -------------------------------------------------------------------------------- /testrun/sqltool/forrows.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests forrows iterator 5 | */ 6 | 7 | create table t(i int, vc varchar(25)); 8 | insert into t values(1, 'one'); 9 | insert into t values(2, 'two'); 10 | insert into t values(null, 'three'); 11 | insert into t values(4, null); 12 | 13 | * *DSV_ROW_DELIM = @ 14 | * if (**ROWS != **NULL) \q **ROWS not null before any forrows 15 | * RES={ 16 | * EXPECTED={ Q1 1|one 1,(one) Q1 2|two 2,(two) Q1 [null]|three ,(three) Q1 4|[null] 4,() } 17 | *forrows INT VCHAR 18 | SELECT * FROM t; 19 | * RES=*{RES} Q1 *{*ROW} 20 | * RES=*{RES} *{:INT},(*{:VCHAR}) 21 | * if (**ROWS != **NULL) \q **ROWS not null inside first forrows 22 | *end forrows 23 | * RES=*{RES} } 24 | * if (*RES != *EXPECTED) \q [*{RES}] != [*{EXPECTED}] 25 | 26 | * if (**ROWS == **NULL) \q **ROWS was not populated by first forrows 27 | * EXPECTED=1|one@2|two@[null]|three@4|[null] 28 | * if (**ROWS != *EXPECTED) \q *ROWS: [*{*ROWS}] != [*{EXPECTED}] 29 | 30 | * RES={ 31 | * EXPECTED={ Q2 1|one Q2 2|two Q2 [null]|three Q2 4|[null] } 32 | *forrows 33 | SELECT * FROM t; 34 | * if (**ROWS != **NULL) \q **ROWS not null inside second forrows 35 | * RES=*{RES} Q2 *{*ROW} 36 | *end forrows 37 | * RES=*{RES} } 38 | * if (*RES != *EXPECTED) \q [*{RES}] != [*{EXPECTED}] 39 | 40 | -- Test that case of 0 rows handled gracefully 41 | DELETE FROM t; 42 | *forrows INT VCHAR 43 | SELECT * FROM t; 44 | \q Executing forrow body when table is empty 45 | *end forrows 46 | *forrows 47 | SELECT * FROM t; 48 | \q Executing forrow body when table is empty 49 | *end forrows 50 | -------------------------------------------------------------------------------- /testrun/sqltool/function.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests SqlTool functions. 5 | */ 6 | 7 | -- Special command function 8 | /= f() \p one *{:2} *{1} four 9 | /f(alpha, beta)five; 10 | /f(alpha) six; 11 | --/f(); 12 | /f(alpha, beta)seven 13 | :; 14 | \p uno *{:2} *{:1} quatro 15 | /: g() sinco 16 | /g(alpha, beta); 17 | 18 | 19 | CREATE TABLE t(i integer, vc varchar(20)); 20 | INSERT INTO t VALUES(1, 'one'); 21 | INSERT INTO t VALUES(2, 'two'); 22 | COMMIT; 23 | 24 | -- SQL functions 25 | \. 26 | INSERT INTO t VALUES(3, 'three'); 27 | SELECT -- Trailing whitespace on next line 28 | * *{1} 29 | . 30 | /: h() t 31 | -- Trailing whitespace on previous line 32 | * quieter ~ 33 | /h(FROM)WHERE i = 3; 34 | * if (*? != three) 35 | \q SqlTool function for multi-line chunked SQL command with appendages failed 36 | *end if 37 | 38 | -- Same but without any appendages 39 | \. 40 | INSERT INTO t VALUES(4, 'four'); 41 | SELECT vc FROM *{1} WHERE i = 4 42 | . 43 | /: f1() 44 | * quieter ~ 45 | /f1(t); 46 | * if (*? != four) 47 | \q SqlTool function for multi-line chunked SQL command (no appendages) failed 48 | *end if 49 | 50 | -- Test function invocation with no params but appendage 51 | \. 52 | INSERT INTO t VALUES(5, 'four'); 53 | SELECT vc FROM t 54 | . 55 | /: f2() 56 | * quieter ~ 57 | /f2() WHERE i = 4; 58 | * if (*? != four) 59 | \q SqlTool function for multi-line chunked SQL command (no params) failed 60 | *end if 61 | -------------------------------------------------------------------------------- /testrun/sqltool/goodsqlonly.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Just runs some successful SQL. 5 | */ 6 | 7 | CREATE TABLE t(i INTEGER); 8 | -------------------------------------------------------------------------------- /testrun/sqltool/history.inter: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests simple recalls and executes : and :;. 5 | */ 6 | 7 | \c false 8 | /* Since running interactively, need to either invoke with --abortOnErr switch, 9 | * or use "\c false" Special command, to detect failures. */ 10 | 11 | CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); 12 | 13 | /* Just verify that an error is not thrown by the two following commands. 14 | And that they don't effect the command history. */ 15 | :b 16 | :h 17 | 18 | INSERT INTO t(vc) VALUES('one'); 19 | INSERT INTO t(vc) VALUES('two'); 20 | INSERT INTO t(vc) VALUES('three'); 21 | 22 | /* Test simple recall and execution */ 23 | :4 24 | :; 25 | :4; 26 | :; 27 | 28 | SELECT count(*) FROM t 29 | *if (*? != 6) \q Recall and execs failed / 1 30 | 31 | /* SELECT vc FROM t; */ 32 | SELECT count(*) FROM t WHERE vc = 'two'; 33 | *if (*? != 4) \q Recall and execs failed / 2 34 | 35 | :/ee/; 36 | 37 | SELECT count(*) FROM t; 38 | *if (*? != 7) \q Regex Recall and execs failed / 1 39 | 40 | /* SELECT vc FROM t; */ 41 | SELECT count(*) FROM t WHERE vc = 'three'; 42 | *if (*? != 2) \q Regex Recall and execs failed / 2 43 | -------------------------------------------------------------------------------- /testrun/sqltool/j.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests \j command 5 | */ 6 | 7 | CREATE TABLE t1(i int); 8 | INSERT INTO t1 VALUES(11); 9 | COMMIT; 10 | 11 | \j SA jdbc:hsqldb:mem:dataSource2 12 | SET PASSWORD 'sapwd'; 13 | CREATE TABLE t2(i int); 14 | INSERT INTO t2 VALUES(22); 15 | COMMIT; 16 | 17 | \j SA jdbc:hsqldb:mem:utst 18 | SELECT * FROM t1; 19 | * if (*? != 11) \q \j failed 20 | 21 | \j SA sapwd jdbc:hsqldb:mem:dataSource2 22 | SELECT * FROM t2; 23 | * if (*? != 22) \q \j failed 24 | -------------------------------------------------------------------------------- /testrun/sqltool/lastval.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests auto-variable ? 5 | */ 6 | 7 | CREATE TABLE t (i INT); 8 | 9 | * if (*? != 0) \q ? variable not capturing CREATE TABLE return value 10 | 11 | INSERT INTO t values (21); 12 | * if (*? != 1) \q ? variable not capturing INSERT return value 13 | 14 | INSERT INTO t values (10); 15 | * if (*? != 1) \q ? variable not capturing INSERT return value 16 | 17 | INSERT INTO t values (43); 18 | * if (*? != 1) \q ? variable not capturing INSERT return value 19 | 20 | SELECT * FROM t ORDER BY i DESC; 21 | * if (*? != 10) \q ? variable not capturing last fetched value 22 | 23 | \p echo some stuff 24 | \p to verify that ? variable value is preserved 25 | * list 26 | 27 | * if (*? != 10) \q ? value not retained after special commands 28 | * if (*{?} != 10) \q ? value not dereferenced with {} usage 29 | -------------------------------------------------------------------------------- /testrun/sqltool/logic.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Logic tests 5 | */ 6 | 7 | *if (1) * T1 = true 8 | *if (! *T1) \q Test of (1) failed 9 | *if (0) \q Test of (0) failed 10 | 11 | *if (! 1) \q Test of (! 1) failed 12 | *if (! 0) * T2 = true 13 | *if (! *T2) \q Test of (! 0) failed 14 | 15 | *if (!1) \q Test of (!1) failed 16 | *if (!0) * T3 = true 17 | *if (!*T3) \q Test of (!0) failed 18 | 19 | * SETVAR=3 20 | *if (*SETVAR) * T4 = true 21 | *if (! *T4) \q Test of (*SETVAR) failed 22 | *if (*UNSETVAR) \q Test of (*UNSETVAR) failed 23 | 24 | *if (! *SETVAR) \q Test of (! *SETVAR) failed 25 | *if (! *UNSETVAR) * T5 = true 26 | *if (! *T5) \q Test of (! *UNSETVAR) failed 27 | 28 | *if (!*SETVAR) \q Test of (!*SETVAR) failed 29 | *if (!*UNSETVAR) * T6 = true 30 | *if (!*T6) \q Test of (!*UNSETVAR) failed 31 | -------------------------------------------------------------------------------- /testrun/sqltool/logical-ops.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Test logical operations. 5 | */ 6 | 7 | * three = 3 8 | * four = 4 9 | 10 | *if (3 != 3) \q 3 != 3 11 | 12 | *if (3 == 4) \q 3 == 4 13 | 14 | *if (3 > 4) \q 3 > 4 15 | 16 | *if (!4 > 3) \q !4 > 3 17 | 18 | *if (3 >= 4) \q 3 >= 4 19 | 20 | *if (4 =< 3) \q 4 =< 3 21 | 22 | *if (*unset1 != *unset2) \q *unset1 != *unset2 23 | 24 | *if (3 == three) \q 3 == three 25 | 26 | *if (3 == four) \q 3 == four 27 | 28 | * blankVar1 = 29 | * blankVar2 = 30 | *if (*blankVar1 != *blankVar2) \q *blankVar1 != *blankVar2 31 | 32 | *if (*blankVar1 == *unset1) \q *blankVar1 == *unset1 33 | 34 | *if (*{blankVar1} != *{blankVar2}) \q *{blankVar1} != *{blankVar2} 35 | -------------------------------------------------------------------------------- /testrun/sqltool/macro.inter: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests interactive macro commands /... 5 | * 6 | * This only tests the buffer macro commands /=:..., so that we can 7 | * manipulate the buffer. 8 | * The other macro commands don't need interactive mode. 9 | */ 10 | 11 | 12 | \c false 13 | 14 | \p hello 15 | /=greet: world 16 | /= 17 | /greet now; 18 | 19 | CREATE TABLE t(i int); 20 | INSERT INTO t VALUES(1); 21 | INSERT INTO t VALUES(2); 22 | INSERT INTO t VALUES(3); 23 | INSERT INTO t VALUES(4); 24 | INSERT INTO t VALUES(5); 25 | COMMIT; 26 | 27 | SELECT count(*) FROM t 28 | 29 | /=q: where 30 | 31 | /q i > 3; 32 | 33 | * if (*? != 2) \q Query returned *{?} rows, should have returned 2. 34 | 35 | /q i > 2 36 | :; 37 | * if (*? != 3) \q Query returned *{?} rows, should have returned 3. 38 | -------------------------------------------------------------------------------- /testrun/sqltool/macro.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests interactive macro commands /... 5 | * 6 | * See macro.inter script also. 7 | */ 8 | 9 | 10 | \c false 11 | 12 | /=q SELECT count(*) FROM t 13 | 14 | CREATE TABLE t(i int); 15 | INSERT INTO t VALUES(1); 16 | INSERT INTO t VALUES(2); 17 | INSERT INTO t VALUES(3); 18 | INSERT INTO t VALUES(4); 19 | INSERT INTO t VALUES(5); 20 | COMMIT; 21 | 22 | /q WHERE i > 3; 23 | 24 | * if (*? != 2) \q Query returned *{?} rows, should have returned 2. 25 | 26 | /* Now test with lots of intervening white space */ 27 | / = q SELECT count(*) FROM t WHERE i > *{LIMIT} 28 | 29 | / = setlim * LIMIT = 30 | 31 | * LIMIT = 4 32 | /q; 33 | * if (*? != 1) \q Query returned *{?} rows, should have returned 1. 34 | 35 | /setlim 3; 36 | /q; 37 | * if (*? != 2) \q Query returned *{?} rows, should have returned 2. 38 | -------------------------------------------------------------------------------- /testrun/sqltool/math.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | 5 | *((x=1+2+3)) 6 | * if (*x != 6) \q Tight (non-whitespace) math expression failed 7 | 8 | *z = notanum 9 | * (( z = 1 + 2 + 3 )) 10 | * if (*z != 6) \q Loose (much-whitespace) math expression failed 11 | 12 | -- Force an error with a non-integral variable 13 | -- *x=werd 14 | 15 | * ((y =(x*2)/3 -(2 + 2))) 16 | * if (*y != 0) \q Math expression with parenthetical nesting failed 17 | 18 | CREATE TABLE t(i INTEGER); 19 | 20 | * ((i = 0)) 21 | * while (*i < 5) 22 | -- \p Next is *{i} 23 | INSERT INTO t VALUES(*{i}); 24 | * ((i = i + 1)) 25 | * end while 26 | 27 | * c _ 28 | SELECT COUNT(*) FROM t; 29 | * if (*c != 5) \q Loop failed to insert right number of records 30 | 31 | * r _ 32 | SELECT COUNT(*) FROM t WHERE i = 4; 33 | * if (*r != 1) \q Loop failed to insert record with i == 4 34 | 35 | *a = 3 36 | *((z=a*2)) 37 | *(( z *= 1 + 1 )) 38 | * if (*z != 12) \q Math op #1 failed 39 | 40 | -- Series of squares 41 | * sum = 0 42 | * i = 0 43 | * while (*i < 5) 44 | * ((sum += i*i)) 45 | * ((i++)) 46 | * end while 47 | * if (*sum != 30) \q Math summation failed 48 | -- Count back down 49 | * while (*i > 0) 50 | * ((i-=1)) -- We do not support '--' 51 | * ((sum -= i*i)) 52 | * end while 53 | * if (*sum != 0) \q Reversion of summation failed. *{sum} left over. 54 | 55 | * (( v1 = (3 + 4) ^ (1 + 2) * 3 )) 56 | * if (*v1 != 1029) \q Power operation failed 57 | -------------------------------------------------------------------------------- /testrun/sqltool/nestingschema.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests a schema creation statement that nests some objects. 5 | */ 6 | 7 | /** 8 | * Besides testing nesting of commands without ; delimiters, this also 9 | * regression tests that the CREATE SCHEMA... command itself does not require 10 | * the closing ; to be sent to the DB engine. 11 | */ 12 | CREATE SCHEMA FELIX AUTHORIZATION DBA 13 | CREATE TABLE FELIXT1 (AV1 VARCHAR(10), BV VARCHAR(10)) 14 | CREATE TABLE FELIXT2 (AV2 VARCHAR(10), BI INTEGER) 15 | CREATE SEQUENCE FELIXS1 16 | CREATE VIEW FELIXV1 AS SELECT * FROM FELIXT1 JOIN FELIXT2 ON AV1 = AV2 17 | CREATE VIEW FELIXV2 AS SELECT AV1 AS C1, NEXT VALUE FOR FELIXS1 AS C2 FROM FELIXT1; 18 | 19 | SELECT count(*) FROM felix.felixv2; 20 | *if (*? != 0) \q Nesting CREATE SCHEMA failed 21 | -------------------------------------------------------------------------------- /testrun/sqltool/noop.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Simplest test possible. Does absolutely nothing. 5 | */ 6 | -------------------------------------------------------------------------------- /testrun/sqltool/nq-arg1.isql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Simplest test of \q from nested script with args 5 | */ 6 | 7 | \q This should cause SqlTool to exit immediately with non-zero exit value. 8 | 9 | /* Following line causes the unit test to fail if the \q above didn't work. 10 | \q 11 | -------------------------------------------------------------------------------- /testrun/sqltool/nq-arg1.nsql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Test of \q with arg from nested script. 5 | */ 6 | 7 | \i nq-arg1.isql 8 | \p Should not have returned from nested script which ran \q. 9 | /* Following line exits with success status to fail the .nsql unit test. 10 | \q 11 | -------------------------------------------------------------------------------- /testrun/sqltool/nq-noarg1.isql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Simplest test of \q from nested script with no args 5 | */ 6 | 7 | \p Following statement should exit SqlTool immediately with success exit status. 8 | \q 9 | 10 | \q This causes the unit test to fail if the \q above didn't work. 11 | -------------------------------------------------------------------------------- /testrun/sqltool/nq-noarg1.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Test of \q with arg from nested script. 5 | */ 6 | 7 | \i nq-noarg1.isql 8 | \q Should not have returned from nested script! 9 | -------------------------------------------------------------------------------- /testrun/sqltool/nullempty.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * This test written verbosely to make it easier to partially share it with 5 | * script sample/nullempty.sql. 6 | * This tests differences between null and empty strings, 7 | * and ? var vs. _/~ variables. 8 | */ 9 | 10 | \p At startup ? is equal to empty string. See between A and B: A*{?}B 11 | * if (A*{?}B != AB) \q ? is not the empty string: *{?} 12 | 13 | CREATE TABLE t(i INTEGER, vc VARCHAR(20)); 14 | INSERT INTO t VALUES(1, 'one'); 15 | INSERT INTO t VALUES(2, 'two'); 16 | * res ~ 17 | SELECT * FROM t; 18 | * if (*? != two) \q ? did not get last cell value 19 | * if (*res != 1) \q res did not get first cell value 20 | 21 | INSERT INTO t VALUES (3, null); 22 | *res ~ 23 | SELECT vc FROM t WHERE i = 3; 24 | * if (*res != **NULL) \q res did not get assigned the SQL Null 25 | * if (*? != [null]) \q ? did not get assigned the *NULL_REP_TOKEN: *{?} 26 | 27 | -- This will prevent SqlTool from aborting when we run a bad SQL statement: 28 | \c true 29 | *res ~ 30 | SELECT hocus FROM pocus; 31 | * if (*? != **NULL) \q ? did not get assigned null upon SQL failure: *{?} 32 | * if (*res != **NULL) \q res did not get assigned null upon SQL failure: *{res} 33 | -------------------------------------------------------------------------------- /testrun/sqltool/nullrep-alt.dsv: -------------------------------------------------------------------------------- 1 | targettable=t} 2 | } 3 | # Following (header) line has intentional trailing whitespace.} 4 | id: i : r : d : t : v : b } 5 | } 6 | # Following line has intentional trailing whitespace (and mixed case).} 7 | wspaces: %% : %% : %% : %% : %% : %% } 8 | nospaces:%%:%%:%%:%%:%%:%%} 9 | -------------------------------------------------------------------------------- /testrun/sqltool/nullrep.dsv: -------------------------------------------------------------------------------- 1 | targettable=t 2 | 3 | # Following (header) line has intentional trailing whitespace. 4 | id| i | r | d | t | v | b 5 | 6 | # Following line has intentional trailing whitespace (and mixed case). 7 | wspaces| [null] | [null] | [null] | [null] | [null] | [null] 8 | nospaces|[null]|[null]|[null]|[null]|[null]|[null] 9 | -------------------------------------------------------------------------------- /testrun/sqltool/q-arg1.nsql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Simplest test of \q with arg 5 | */ 6 | 7 | \q Quitting with non-zero exit status 8 | -------------------------------------------------------------------------------- /testrun/sqltool/q-noarg1.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Simplest test of \q with no args 5 | */ 6 | 7 | \p Just quitting. Should exit with 0 (success) exit status. 8 | \q 9 | -------------------------------------------------------------------------------- /testrun/sqltool/rawmode.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests raw mode 5 | */ 6 | 7 | CREATE TABLE t (i INTEGER); 8 | INSERT INTO t values (42); 9 | 10 | /** Adding a few blank lines in what is sent to server on purpose. */ 11 | \. 12 | 13 | 14 | SELECT i FROM t 15 | 16 | 17 | .; 18 | 19 | *if (*? != 42) \q Raw command failed 20 | 21 | -- To change results so we can be confident of getting 1 later on. 22 | INSERT INTO t values (43); 23 | SELECT * FROM t; 24 | 25 | \. 26 | SELECT count(*) FROM t 27 | . 28 | :a WHERE i = 42 29 | ; 30 | *if (*? != 1) \q Raw command failed 31 | -------------------------------------------------------------------------------- /testrun/sqltool/return.isql: -------------------------------------------------------------------------------- 1 | /** 2 | * The return statement below should abort this script immediately without 3 | * triggering any error handling. 4 | */ 5 | 6 | * VAR=*{VAR} two 7 | 8 | * return 9 | 10 | \q return did not cause nested script ireturn.sql to return 11 | * VAR=*{VAR} three 12 | -------------------------------------------------------------------------------- /testrun/sqltool/return.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests the new "return" statement, which is equivalent to a "break" statement 5 | * with no parameter. 6 | */ 7 | 8 | * VAR=one 9 | \i return.isql 10 | * VAR=*{VAR} three 11 | 12 | * EXPECTED = one two three 13 | * if (*VAR != *EXPECTED) \q return statement failed: (*{VAR}) vs. (*{EXPECTED}) 14 | 15 | * return 16 | 17 | \q return.sql ran past the return statement 18 | -------------------------------------------------------------------------------- /testrun/sqltool/rowcount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests automatic variable # 5 | */ 6 | 7 | create table t(i int, vc varchar(25)); 8 | insert into t values(1, 'one'); 9 | insert into t values(2, 'two'); 10 | insert into t values(null, 'three'); 11 | insert into t values(4, null); 12 | * var = x 13 | 14 | *if (*# != 0) \q Initial value of # != 0: *{#} 15 | 16 | *forrows INT VCHAR 17 | SELECT * FROM t WHERE i IS NOT null; 18 | *if (*# != 3) \q # inside forrows != 3: *{#} 19 | *end forrows 20 | *if (*# != 3) \q # after forrows != 3: *{#} 21 | 22 | SELECT * FROM t WHERE i = 2; 23 | *if (*# != 1) \q # after single-row SELECT: *{#} 24 | -- Test with nesting 25 | *if (1 == 1) 26 | *if (*# != 1) \q # nexted after single-row SELECT: *{#} 27 | SELECT * FROM t WHERE i > 1; 28 | *if (*# != 2) \q # after SELECT != 2: *{#} 29 | *end if 30 | *if (*# != 2) \q # after nested SELECT != 2: *{#} 31 | -------------------------------------------------------------------------------- /testrun/sqltool/sqlarray.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests basic usage of SQL Arrays 5 | */ 6 | 7 | CREATE TABLE a (i BIGINT PRIMARY KEY, ar INTEGER ARRAY); 8 | 9 | INSERT INTO a VALUES (1, array [11, null, 13]); 10 | INSERT INTO a VALUES (2, null); 11 | INSERT INTO a VALUES (3, array [21, 22]); 12 | 13 | * ROWCOUNT _ 14 | SELECT count(*) FROM a; 15 | 16 | * if (*ROWCOUNT != 3) \q Failed to insert 3 rows with SQL Values 17 | 18 | * ROWCOUNT _ 19 | SELECT count(*) FROM a WHERE i = 1 AND ar[3] = 13; 20 | * if (*ROWCOUNT != 1) \q Failed to read imported SQL Array Element 21 | -------------------------------------------------------------------------------- /testrun/sqltool/sqljrt.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests SQL/JRT 5 | */ 6 | 7 | create function dehex(VARCHAR(80), INTEGER) 8 | returns INTEGER 9 | no sql 10 | language java 11 | external name 'CLASSPATH:java.lang.Integer.valueOf' 12 | .; 13 | 14 | CALL dehex('12', 16); 15 | *if (*? != 18) \q SQL/JRT function failed 16 | -------------------------------------------------------------------------------- /testrun/sqltool/sqlpsm.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests SQL/JRT 5 | */ 6 | 7 | create table customers( 8 | id INTEGER default 0, firstname VARCHAR(50), lastname VARCHAR(50), 9 | entrytime TIMESTAMP); 10 | 11 | create procedure new_customer(firstname varchar(50), lastname varchar(50)) 12 | modifies sql data 13 | insert into customers values ( 14 | default, firstname, lastname, current_timestamp) 15 | .; 16 | 17 | SELECT count(*) FROM customers; 18 | *if (*? != 0) \q SQL/PSM preparation failed 19 | 20 | CALL new_customer('blaine', 'simpson'); 21 | 22 | SELECT count(*) FROM customers; 23 | *if (*? != 1) \q SQL/PSM procedure failed 24 | -------------------------------------------------------------------------------- /testrun/sqltool/subdir/atuser.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Test loading other files with @ 5 | */ 6 | 7 | \i @/tblx.sql 8 | 9 | \m @/tblx.dsv 10 | 11 | SELECT COUNT(*) FROM tblx; 12 | *if (*? != 2) \q Failed to load table deta from @ directory 13 | -------------------------------------------------------------------------------- /testrun/sqltool/subdir/tblx.dsv: -------------------------------------------------------------------------------- 1 | id|vc 2 | 1|one 3 | 2|two 4 | -------------------------------------------------------------------------------- /testrun/sqltool/subdir/tblx.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Test loading other files with @ 5 | */ 6 | 7 | CREATE TABLE tblx ( 8 | id INTEGER, 9 | vc VARCHAR(10) 10 | ); 11 | -------------------------------------------------------------------------------- /testrun/sqltool/subst.inter: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Tests interactive commands :s*. 5 | */ 6 | 7 | \c false 8 | /* Since running interactively, need to either invoke with --abortOnErr switch, 9 | * or use "\c false" Special command, to detect failures. */ 10 | 11 | CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); 12 | 13 | INSERT INTO t(vc) VALUES('one') 14 | 15 | /* In interactive mode, the blank line above will move the command to the 16 | * edit buffer without executing it. */ 17 | 18 | :s/n/MM/; 19 | /*Since this executes, command #3 in history will become "INSERT... 'oMMe'".*/ 20 | 21 | SELECT count(*) FROM t; 22 | *if (*? != 1) \q Blank lines not behaving right in Interactive mode 23 | 24 | SELECT count(*) FROM t WHERE vc = 'oMMe'; 25 | *if (*? != 1) \q Simple substitution of edit buffer failed. 26 | 27 | /* Tailing white space in line below, on purpose. */ 28 | :3 s@M@.@g; 29 | 30 | SELECT count(*) FROM t; 31 | *if (*? != 2) \q Recall + subst. + exec failed / 1 32 | 33 | SELECT count(*) FROM t WHERE vc = 'o..e'; 34 | *if (*? != 1) \q Recall + subst. + exec failed / 2 35 | 36 | :3 37 | /* Purposeful trailing white space in following line */ 38 | :s:MM:x:g 39 | :; 40 | 41 | SELECT count(*) FROM t; 42 | *if (*? != 3) \q Recall + subst., then exec failed / 1 43 | 44 | SELECT count(*) FROM t WHERE vc = 'oxe'; 45 | *if (*? != 1) \q Recall + subst., then exec failed / 2 46 | 47 | :/INSERT.*MM/ 48 | :s/Me/End/; 49 | \q 50 | :/INSERT.*MM/s/(?-i)o/Begin/; 51 | 52 | SELECT count(*) FROM t; 53 | *if (*? != 5) \q Regex Recall + subst., then exec failed / 1 54 | 55 | SELECT count(*) FROM t WHERE vc = 'oMEnd'; 56 | *if (*? != 1) \q Regex Recall + subst., then exec failed / 2 57 | 58 | SELECT count(*) FROM t WHERE vc = 'Begin..e'; 59 | *if (*? != 1) \q Regex Recall + subst., then exec failed / 3 60 | -------------------------------------------------------------------------------- /testrun/sqltool/unseteval.nsql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Invokes another script that defines variables. 5 | * Then we test that we have access to the variables. 6 | */ 7 | 8 | *if (*{unset} == 3) \p Should not succeed 9 | -------------------------------------------------------------------------------- /testrun/sqltool/unsetvar.nsql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Invokes another script that defines variables. 5 | * Then we test that we have access to the variables. 6 | */ 7 | 8 | \p *{unsetvar} 9 | -------------------------------------------------------------------------------- /testrun/sqltool/unsetvar.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | 5 | \p *{:unsetvar} 6 | 7 | *if (*x != *y) \q Two unset variables are not equal 8 | 9 | *x = 10 | *if (*x == *y) \q A variable set to '' is equal to an unset variable 11 | 12 | *z = 13 | *if (*x != *z) \q Two variables set to '' are not equal 14 | -------------------------------------------------------------------------------- /testrun/sqltool/urlnester.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Invokes another script that defines variables. 5 | * Then we test that we have access to the variables. 6 | */ 7 | 8 | /* Want to test with no user variables set like this, but unfortunately the 9 | test script invoker always sets one user variable: 10 | \p *{testvar} -- Should not expand the variable but should not abort 11 | */ 12 | 13 | \i file:varnestee.isql 14 | 15 | \p *{x} 16 | -------------------------------------------------------------------------------- /testrun/sqltool/varnestee.isql: -------------------------------------------------------------------------------- 1 | * x = eks 2 | -------------------------------------------------------------------------------- /testrun/sqltool/varnester.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Invokes another script that defines variables. 5 | * Then we test that we have access to the variables. 6 | */ 7 | 8 | /* Want to test with no user variables set like this, but unfortunately the 9 | test script invoker always sets one user variable: 10 | \p *{testvar} -- Should not expand the variable but should not abort 11 | */ 12 | 13 | \i varnestee.isql 14 | 15 | \p *{x} 16 | -------------------------------------------------------------------------------- /testrun/sqltool/vars.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | 5 | * mt1 = 6 | * mt2 = 7 | -- Following line has trailing white space, but that should have no effect. 8 | * mt3 = 9 | * - un1 10 | * - un2 11 | 12 | * if (*unsetA != **NULL) \q Never used variable is not **NULL 13 | * if (*un1 != **NULL) \q Explicitly unset variable is not **NULL 14 | * if (*unsetA != *unsetB) \q Two never-set vars differ 15 | * if (*un1 != *un2) \q Two explicitly unset variables differ 16 | * if (*un1 != *unsetA) \q Explicitly unset vs. neverset vars differ 17 | 18 | * if (*mt1 != *mt2) \q Two legacy-unset vars differ 19 | 20 | * if (*mt1 != *mt3) \q Two legacy-unset vars differ, one set to blanks 21 | 22 | * if (*mt1 == *unset) \q Legacy-unset var != never-set var 23 | 24 | * if (alpha != alpha) \q Sanity constant comparison failed 25 | 26 | * a = alpha 27 | * anotherA = alpha 28 | * if (*a != *anotherA) \q To equivalant variable values differ 29 | 30 | -- Following two have 2 trailing spaces: 31 | * wsTrailed1 = alpha 32 | * wsTrailed2 = alpha 33 | * if (*wsTrailed1 == a) 34 | \q Trailing white-space not honored in logical evaluation 35 | * end if 36 | * if (*wsTrailed1 != *wsTrailed2) 37 | \q Trailing white-space not valued equally for logical evaluation 38 | * end if 39 | 40 | * wsEmbed1 = alpha beta 41 | * wsEmbed2 = alpha beta 42 | * if (*wsEmbed1 != *wsEmbed2) 43 | \q Embedded white-space not valued equally for logical evaluation 44 | * end if 45 | -------------------------------------------------------------------------------- /testrun/sqltool/varswithspaces.sql: -------------------------------------------------------------------------------- 1 | /** 2 | * Logical expressions where elements contain spaces. 3 | */ 4 | 5 | * str1 = one two 6 | * expected = one two 7 | * wrong1 = one two 8 | * wrong2 = one 9 | * wrong3 = two 10 | 11 | *if (*str1 == *wrong1) \q 'one two' == 'one two' 12 | *if (*str1 == *wrong2) \q 'one two' == 'one' 13 | *if (*str1 == *wrong3) \q 'one two' == 'two' 14 | *if (*str1 != *expected) \q (*{str1}) vs. (*{expected}) 15 | --------------------------------------------------------------------------------

rej. #input
line #
28 | bad column
(if known)
reason