diff -Nru hsqldb-2.6.1/debian/changelog hsqldb-2.7.0/debian/changelog
--- hsqldb-2.6.1/debian/changelog 2021-10-22 10:46:07.000000000 +0000
+++ hsqldb-2.7.0/debian/changelog 2022-08-06 10:56:15.000000000 +0000
@@ -1,3 +1,10 @@
+hsqldb (2.7.0-1) unstable; urgency=medium
+
+ * New upstream version 2.7.0.
+ * Declare compliance with Debian Policy 4.6.1.
+
+ -- Markus Koschany Each module has a page that contains a list of its packages, dependencies on other modules, and services, with a summary for each. These page may contain three categories: Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain six categories: Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions: Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer. Each annotation type has its own separate page with the following sections: Each enum has its own separate page with the following sections: Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its "Use" page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar. There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations. The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields, as well as lists of all packages and all classes. The All Classes link shows all classes and interfaces except non-static nested types. Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. The Constant Field Values page lists the static final fields and their values. You can search for definitions of modules, packages, types, fields, methods and other terms defined in the API, using some or all of the name. "Camel-case" abbreviations are supported: for example, "InpStr" will find "InputStream" and "InputStreamReader".
+ The file
+ The complexities of passing userVars and macros maps are to facilitate
+ strong scoping (among blocks and nested scripts).
+
+ Some implementation comments and variable names use keywords based
+ on the following definitions.
+ When entering SQL statements, you are always "appending" to the
+ "immediate" command (not the "buffer", which is a different thing).
+ All you can do to the immediate command is append new lines to it,
+ execute it, or save it to buffer.
+ When you are entering a buffer edit command like ":s/this/that/",
+ your immediate command is the buffer-edit-command. The buffer
+ is the command string that you are editing.
+ The buffer usually contains either an exact copy of the last command
+ executed or sent to buffer by entering a blank line,
+ but BUFFER commands can change the contents of the buffer.
+
+ In general, the special commands mirror those of Postgresql's psql,
+ but SqlFile handles command editing very differently than Postgresql
+ does, in part because of Java's lack of support for raw tty I/O.
+ The \p special command, in particular, is very different from psql's.
+
+ Buffer commands are unique to SQLFile. The ":" commands allow
+ you to edit the buffer and to execute the buffer.
+
+ \d commands are very poorly supported for Mysql because
+ (a) Mysql lacks most of the most basic JDBC support elements, and
+ the most basic role and schema features, and
+ (b) to access the Mysql data dictionary, one must change the database
+ instance (to do that would require work to restore the original state
+ and could have disastrous effects upon transactions).
+
+ The process*() methods, other than processBuffHist() ALWAYS execute
+ on "buffer", and expect it to contain the method specific prefix
+ (if any).
+
+ The input/output Reader/Stream are generally managed by the caller.
+ An exception is that the input reader may be closed automatically or on
+ demand by the user, since in some cases this class builds the Reader.
+ There is no corresponding functionality for output since the user always
+ has control over that object (which may be null or System.out).
+ Most Special Commands and many Buffer commands are only for
+ interactive use.
+
+ This program never writes to an error stream (stderr or alternative).
+ All meta messages and error messages are written using the logging
+ facility.
+
+ execute() will close the Reader by default (i.e. 'autoClose' defaults
+ to true).
+ You may want to set this to false if you want to stop execution with
+ \q or similar, then continue using the Reader or underlying Stream.
+
+ The caller is always responsible for closing the output object (if any)
+ used by SqlFile.
+ N.b.: If this returns "true" for a type, then the user can never
+ "see" values for these columns.
+ Therefore, if a type may-or-may-not-be displayable, better to return
+ false here and let the user choose.
+ In general, if there is a toString() operator for this Sql Type
+ then return false, since the JDBC driver should know how to make the
+ value displayable.
+
+ This class has a misleading name and should really be renamed.
+ It is Java Exception, not a Java Error.
+
+ See JavaDocs for the main method for syntax of how to run from the
+ command-line.
+
+ Programmatic users will usually want to use the objectMain(String[]) method
+ if they want arguments and behavior exactly like command-line SqlTool.
+ But in many cases, you will have better control and efficiency by using
+ the SqlFile class directly. The file
+
+ Throws only RuntimeExceptions or Errors, because this method is intended
+ to System.exit() for all but disastrous system problems, for which
+ the inconvenience of a stack trace would be the least of your worries.
+
+ If you don't want SqlTool to System.exit(), then use the method
+ objectMain() instead of this method.
+ This method is changed for HSQLDB 1.8.0.8 and later to never
+ System.exit().
+ Developers may catch Throwables to handle all fatal situations. Copyright 2010-2021 Fred Toussi. Permission is granted to
+
+ Copyright 2010-2022 Fred Toussi. Permission is granted to
distribute this document without any alteration under the terms of the
HSQLDB license. Additional permission is granted to the HSQL Development
Group to distribute this document with or without alterations under the
@@ -57,7 +57,7 @@
2021-10-21 2022-07-26 This chapter is about access control to database objects such as
- tables, inside the database engine. Other issues related to security
- include user authentication, password complexity and secure connections
+ This chapter is about controlling access to database objects such as
+ tables and routines. Other topics related to security include user
+ authentication, password complexity and secure connections. These topics
are covered in the System Management chapter and the HyperSQL Network Listeners
(Servers) chapter. Apart from schemas and their object, each HyperSQL catalog has USER
and ROLE objects. These objects are collectively called
authorizations. Each AUTHORIZATION has some access
- rights on some of the schemas or the objects they contain. The persistent
- elements of an SQL environment are database objects Authorization names are stored in the database in the case-normal
- form. When connecting to a database via JDBC, the user name and password
- must match the case of this case-normal form. When a user is created with the CREATE USER statement, if the user
- name is enclosed in double quotes, the exact name is used as the
- case-normal form. But if it is not enclosed in double quotes, the name is
- converted to uppercase and this uppercase version is stored in the
- database as the case-normal form.
*
* Now, for each alternative, adjust environment and build properties, like
- * by setting env var JAVA_HOME or build property 'build.debug', and run
+ * by setting build property 'build.debug', and run
*
*
- * gradlew -x sqltool -x osgi -b mvn-pub.gradle
+ * gradlew -x sqltool -x hsqldb -b mvn-pub.gradle
*
* The clean-all will wipe .../doc, but the .../doc and everything else from
* your original dist build will be retained in .../dist/*.zip.
@@ -197,18 +209,18 @@
// Funny name is work-around for Gradle sequencing bug
task zJarDep { doLast {
if (jar.archivePath.exists() && jar.archivePath.lastModified()
- < file('../lib/hsqldb-osgi.jar').lastModified()) {
+ < file('../lib/hsqldb.jar').lastModified()) {
logger.warn "Deleting $jar.archivePath.absolutePath"
jar.archivePath.delete()
}
} }
jar { doLast {
- File srcFile = file('../lib/hsqldb-osgi.jar')
+ File srcFile = file('../lib/hsqldb.jar')
jar.archivePath.setBytes(srcFile.bytes)
} }
-jar.dependsOn = [osgi, zJarDep]
+jar.dependsOn = [hsqldb, zJarDep]
if (project.hasProperty('classifier')) jar.classifier = project.classifier
clean.dependsOn = [prohibitionMap['clean']]
@@ -233,10 +245,10 @@
sqltoolJar.archivePath.setBytes(srcFile.bytes)
} }
-task sourcesJar(type: Jar, dependsOn:classes) {
- classifier = 'sources'
- //from sourceSets.main.allSource
- from fileTree(dir: '../src')
+task sourcesJar(type: Jar, dependsOn:hsqldbsources) {
+ classifier = 'sources'
+ //from sourceSets.main.allSource
+ from { zipTree '../lib/hsqldb-sources.jar' }
}
sourcesJar.description = 'Build sources jar file'
@@ -247,11 +259,11 @@
}
javadocJar.description = 'Build javadoc jar file'
-task sqltoolSourcesJar(type: Jar, dependsOn:classes) {
+task sqltoolSourcesJar(type: Jar, dependsOn:sqltoolsources) {
archiveBaseName = 'sqltool'
classifier = 'sources'
//from sourceSets.main.allSource
- from fileTree(dir: '../src')
+ from { zipTree '../lib/sqltool-sources.jar' }
}
sqltoolSourcesJar.description = 'Build Sqltool sources jar file'
@@ -259,7 +271,7 @@
archiveBaseName = 'sqltool'
classifier = 'javadoc'
//from javadoc.destinationDir
- from fileTree(dir: '../doc/apidocs')
+ from fileTree(dir: '../doc/apidocssqltool')
}
sqltoolJavadocJar.description = 'Build Sqltool javadoc jar file'
diff -Nru hsqldb-2.6.1/hsqldb/build/setenv.cmd hsqldb-2.7.0/hsqldb/build/setenv.cmd
--- hsqldb-2.6.1/hsqldb/build/setenv.cmd 2018-10-23 07:24:42.000000000 +0000
+++ hsqldb-2.7.0/hsqldb/build/setenv.cmd 2022-02-21 14:42:08.000000000 +0000
@@ -1,7 +1,7 @@
REM basic environment setup
REM change as needed
-set JAVA_HOME=C:\Program Files\Java\jdk7
-set ANT_HOME=C:\java\lib\ant
+set JAVA_HOME=C:\Program Files\Java\jdk8
+set ANT_HOME=C:\Program Files\NetBeans-12.6\netbeans\extide\ant
set ANT_OPTS=-Xmx512m
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%
diff -Nru hsqldb-2.6.1/hsqldb/build/test.xml hsqldb-2.7.0/hsqldb/build/test.xml
--- hsqldb-2.6.1/hsqldb/build/test.xml 2021-03-20 09:02:12.000000000 +0000
+++ hsqldb-2.7.0/hsqldb/build/test.xml 2022-05-18 09:38:44.000000000 +0000
@@ -21,7 +21,7 @@
- * gradlew -Pclassifier=NEW_CLASSIFIER -b mvn-pub.gradle clean-all uploadArchives
+ * [single-command no longer works due to broken inter-dependencies:
+ * gradlew -Pclassifier=NEW_CLASSIFIER -b mvn-pub.gradle clean-all uploadArchives]
+ * gradlew -b mvn-pub.gradle clean-all
+ * gradlew -Pclassifier=NEW_CLASSIFIER -b mvn-pub.gradle sqltool
+ * gradlew -Pclassifier=NEW_CLASSIFIER -b mvn-pub.gradle hsqldb
+ * gradlew -Pclassifier=NEW_CLASSIFIER -b mvn-pub.gradle -x sqltool -x hsqldb
+ *
+ * # Restore regular build property values
+ * pushd ../lib; mkdir ../safe.d; mv -v hsqldb.jar sqltool.jar ../safe.d/
+ * mv -v hsqldb-jdk8.jar hsqldb.jar && mv -v sqltool-jdk8.jar sqltool.jar
+ * popd
+ * gradlew -Pclassifier=jdk8 -b mvn-pub.gradle -x sqltool -x hsqldb
+ *
*
All Classes
+All Classes
+
+
+
+
+
+
+Class
+Description
+
+
+SqlFile
+
+
+
+
+SqlFile.BadSpecial
+
+
+
+
+SqlTool
+
+
+
+
+SqlTool.SqlToolException
+
+
+
+SqlToolError
+
+
+
+
+SqltoolRB
+
+
+
+
+SqlToolSprayer
+
+
+All Packages
+
+
+
+
+
+
+
+Package
+Description
+
+
+
+org.hsqldb.cmdline
+
+
+Constant Field Values
+Contents
+
+
+org.hsqldb.*
+
+
+
+
+
+
+
+Modifier and Type
+Constant Field
+Value
+
+
+
+
+
+public static final int
+CONNECTERR_EXITVAL
+7
+
+
+
+
+public static final int
+FILEERR_EXITVAL
+5
+
+
+
+
+public static final int
+INPUTERR_EXITVAL
+6
+
+
+
+
+public static final int
+IOERR_EXITVAL
+4
+
+
+
+
+public static final int
+RCERR_EXITVAL
+2
+
+
+
+
+public static final int
+SQLERR_EXITVAL
+3
+
+
+
+
+public static final int
+SQLTOOLERR_EXITVAL
+1
+
+
+
+
+
+public static final int
+SYNTAXERR_EXITVAL
+11
Deprecated API
+Contents
+How This API Document Is Organized
+
+
+Module
+
+
+Package
+
+
+Class or Interface
+
+
+
+
+
+
+
+
+Annotation Type
+
+
+Enum
+
+
+Use
+Tree (Class Hierarchy)
+java.lang.Object
. Interfaces do not inherit from java.lang.Object
.
+
+Deprecated API
+Index
+All Classes
+Serialized Form
+Constant Field Values
+Search
+
+This help file applies to API documentation generated by the standard doclet.
All Classes All Packages
+
+
+A
+
+
+
+
+
+B
+
+
+
+
+
+C
+
+
+
+
+
+D
+
+
+
+
+
+E
+
+
+
+
+
+F
+
+
+
+
+
+G
+
+
+
+
+
+H
+
+
+
+
+
+I
+
+
+
+
+
+J
+
+
+
+
+
+L
+
+
+
+
+
+M
+
+
+
+
+
+N
+
+
+
+
+
+O
+
+
+
+
+
+P
+
+
+
+
+
+Q
+
+
+
+
+
+R
+
+
+
+
+
+S
+
+
+
+
+
+T
+
+
+
+
+
+V
+
+
+A B C D E F G H I J L M N O P Q R S T V
All Classes All PackagesModule org.hsqldb.sqltool
+
+
+
+
+Packages
+
+
+
+
+
+Package
+Description
+
+
+
+org.hsqldb.cmdline
+
+
+Uses of Class
+
org.hsqldb.cmdline.SqlFile.BadSpecial
+
+
+
+Uses of SqlFile.BadSpecial in org.hsqldb.cmdline
+
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+
+java.lang.String
SqlFile.
+getCurrentSchema()
+Uses of Class
+
org.hsqldb.cmdline.SqlFileUses of Class
+
org.hsqldb.cmdline.SqlToolError
+
+
+
+Uses of SqlToolError in org.hsqldb.cmdline
+
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+void
SqlFile.
+dsvSafe(java.lang.String s)
+
+
+
+
+void
SqlFile.
+execute()
+
+
+
+
+java.lang.String
SqlFile.
+getCurrentSchema()
+
+
+
+
+void
SqlFile.
+importDsv(java.net.URL fileUrl,
+ java.lang.String skipPrefix)
+
+Uses of Class
+
org.hsqldb.cmdline.SqlToolUses of Class
+
org.hsqldb.cmdline.SqltoolRB
+
+
+
+Uses of SqltoolRB in org.hsqldb.cmdline
+
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+static SqltoolRB
SqltoolRB.
+valueOf(java.lang.String name)
+
+
+
+
+
+static SqltoolRB[]
SqltoolRB.
+values()
+
+Uses of Class
+
org.hsqldb.cmdline.SqlToolSprayerUses of Class
+
org.hsqldb.cmdline.SqlTool.SqlToolException
+
+
+
+Uses of SqlTool.SqlToolException in org.hsqldb.cmdline
+
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+
+static void
SqlTool.
+objectMain(java.lang.String[] arg)
+
+Package org.hsqldb.cmdline
+
+
+
+
+
+
+
+Class
+Description
+
+
+SqlFile
+
+
+
+
+SqlTool
+
+
+
+
+
+SqlToolSprayer
+
+
+
+
+
+
+
+Enum
+Description
+
+
+
+SqltoolRB
+
+
+
+
+
+
+
+Exception
+Description
+
+
+SqlFile.BadSpecial
+
+
+
+
+SqlTool.SqlToolException
+
+
+
+
+SqlToolError
+
+
+Hierarchy For Package org.hsqldb.cmdline
+Class Hierarchy
+
+
+
+
+
+
+
+
+
+
+Enum Hierarchy
+
+
+
+
+
+
+Uses of Package
+
org.hsqldb.cmdline
+
+
+
+
+
+
+Class
+Description
+
+
+SqlFile.BadSpecial
+
+
+
+
+SqlTool.SqlToolException
+
+
+
+SqlToolError
+
+
+
+
+
+SqltoolRB
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+java.io.Serializable
+
+
+public static class SqlFile.BadSpecial
+extends org.hsqldb.cmdline.libclone.AppendableException
+
+
+
+
+
+
+Method Summary
+
+
+Methods inherited from class org.hsqldb.cmdline.libclone.AppendableException
+appendMessage, getMessage
+
+Methods inherited from class java.lang.Throwable
+addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+
+
+public class SqlFile
+extends java.lang.Object
+src/org/hsqldb/sample/SqlFileEmbedder.java
+ in the HSQLDB distribution provides an example for using SqlFile to
+ execute SQL files directly from your own Java classes.
+
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+
+Modifier and Type
+Class
+Description
+
+
+
+static class
+SqlFile.BadSpecial
+
+
+
+Constructor Summary
+
+
+
+
+Constructor
+Description
+
+
+
+SqlFile(java.io.File inputFile)
+
+
+
+
+SqlFile(java.io.File inputFile,
+ java.lang.String encoding)
+
+
+
+
+SqlFile(java.io.File inputFile,
+ java.lang.String encoding,
+ boolean interactive)
+
+
+
+
+SqlFile(java.io.Reader reader,
+ java.lang.String inputStreamLabel,
+ java.io.PrintStream psStd,
+ java.lang.String encoding,
+ boolean interactive,
+ java.io.File atBaseFile)
+
+
+
+
+SqlFile(java.io.Reader reader,
+ java.lang.String inputStreamLabel,
+ java.io.PrintStream psStd,
+ java.lang.String encoding,
+ boolean interactive,
+ java.net.URL atBase)
+
+
+
+
+SqlFile(java.lang.String encoding,
+ boolean interactive)
+
+
+
+
+SqlFile(java.net.URL inputUrl)
+
+
+
+SqlFile(java.net.URL inputUrl,
+ java.lang.String encoding)
+
+
+
+SqlFile(java.net.URL inputUrl,
+ java.lang.String encoding,
+ boolean interactive)
+
+
+Method Summary
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+void
+addMacros(java.util.Map<java.lang.String,org.hsqldb.cmdline.sqltool.Token> newMacros)
+
+
+
+void
+addUserVars(java.util.Map<java.lang.String,java.lang.String> newUserVars)
+
+
+
+static byte[]
+bitCharsToBytes(java.lang.String hexChars)
+
+
+
+
+static boolean
+canDisplayType(int i)
+
+
+
+
+void
+closeReader()
+
+
+
+
+static java.lang.String
+convertEscapes(java.lang.String inString)
+
+
+
+
+void
+dsvSafe(java.lang.String s)
+
+
+
+
+static java.lang.String
+escapeHtml(java.lang.String s)
+
+
+
+
+void
+execute()
+
+
+
+
+static java.lang.String
+getBanner(java.sql.Connection c)
+
+
+
+
+java.sql.Connection
+getConnection()
+
+
+
+java.lang.String
+getCurrentSchema()
+
+
+
+java.util.Map<java.lang.String,org.hsqldb.cmdline.sqltool.Token>
+getMacros()
+
+
+
+java.util.Map<java.lang.String,java.lang.String>
+getUserVars()
+
+
+
+
+static byte[]
+hexCharOctetsToBytes(java.lang.String hexChars)
+
+
+
+
+void
+importDsv(java.net.URL fileUrl,
+ java.lang.String skipPrefix)
+
+
+
+
+static byte[]
+loadBinary(java.io.File binFile)
+
+
+
+
+static byte[]
+loadBinary(java.net.URL binUrl)
+
+
+
+
+void
+setAutoClose(boolean autoClose)
+
+
+
+
+void
+setConnection(java.sql.Connection jdbcConn)
+
+
+
+void
+setContinueOnError(boolean continueOnError)
+
+
+
+void
+setMaxHistoryLength(int maxHistoryLength)
+
+
+
+static java.lang.String
+sqlTypeToString(int i)
+
+
+
+
+static byte[]
+streamToBytes(java.io.InputStream is)
+
+
+
+
+java.lang.String
+streamToString(java.io.InputStream is,
+ java.lang.String cs)
+
+
+
+
+static java.lang.String
+toPaddedString(java.lang.String source,
+ int length,
+ char pad,
+ boolean trailing)
+
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+Constructor Detail
+
+
+
+
+
+
+
+
+SqlFile
+public SqlFile(java.io.File inputFile)
+ throws java.io.IOException
+
+
+inputFile
- input filejava.io.IOException
- on read errorsSqlFile(File, String)
+
+
+
+
+SqlFile
+public SqlFile(java.net.URL inputUrl)
+ throws java.io.IOException
+
+
+java.io.IOException
+
+
+
+
+SqlFile
+public SqlFile(java.io.File inputFile,
+ java.lang.String encoding)
+ throws java.io.IOException
+
+
+inputFile
- the input Fileencoding
- is applied to both the given File and other files read
+ in or written out. Null will use your env+JVM settings.java.io.IOException
- on read errorsSqlFile(File, String, boolean)
+
+
+
+
+SqlFile
+public SqlFile(java.net.URL inputUrl,
+ java.lang.String encoding)
+ throws java.io.IOException
+
+
+java.io.IOException
+
+
+
+
+SqlFile
+public SqlFile(java.io.File inputFile,
+ java.lang.String encoding,
+ boolean interactive)
+ throws java.io.IOException
+
+
+inputFile
- the input Fileencoding
- is applied to the given File and other files
+ read in or written out. Null will use your env+JVM settings.interactive
- If true, prompts are printed, the interactive
+ Special commands are enabled, and
+ continueOnError defaults to true.java.io.IOException
- on read errorsSqlFile(Reader, String, PrintStream, String, boolean, File)
+
+
+
+
+SqlFile
+public SqlFile(java.net.URL inputUrl,
+ java.lang.String encoding,
+ boolean interactive)
+ throws java.io.IOException
+
+
+java.io.IOException
+
+
+
+
+SqlFile
+public SqlFile(java.lang.String encoding,
+ boolean interactive)
+ throws java.io.IOException
+
+
+encoding
- is applied to other files read in or written out (but
+ not to stdin or stdout).
+ Null will use your env+JVM settings.interactive
- If true, prompts are printed, the interactive
+ Special commands are enabled, and
+ continueOnError defaults to true.java.io.IOException
- on read errorsSqlFile(Reader, String, PrintStream, String, boolean, File)
+
+
+
+
+SqlFile
+public SqlFile(java.io.Reader reader,
+ java.lang.String inputStreamLabel,
+ java.io.PrintStream psStd,
+ java.lang.String encoding,
+ boolean interactive,
+ java.io.File atBaseFile)
+ throws java.io.IOException
+
+
+java.io.IOException
+
+SqlFile
+public SqlFile(java.io.Reader reader,
+ java.lang.String inputStreamLabel,
+ java.io.PrintStream psStd,
+ java.lang.String encoding,
+ boolean interactive,
+ java.net.URL atBase)
+ throws java.io.IOException
+
+
+reader
- Source for the SQL to be executed.
+ Caller is responsible for setting up encoding.
+ (the 'encoding' parameter will NOT be applied
+ to this reader).inputStreamLabel
- the lablepsStd
- PrintStream for normal output.
+ If null, normal output will be discarded.
+ Caller is responsible for settingup encoding
+ (the 'encoding' parameter will NOT be applied
+ to this stream).encoding
- the encodinginteractive
- If true, prompts are printed, the interactive
+ Special commands are enabled, and
+ continueOnError defaults to true.atBase
- the base dirjava.io.IOException
- on read errorsexecute()
+
+Method Detail
+
+
+
+
+
+
+
+
+setConnection
+public void setConnection(java.sql.Connection jdbcConn)
+
+
+
+
+
+getConnection
+public java.sql.Connection getConnection()
+
+
+
+
+
+setContinueOnError
+public void setContinueOnError(boolean continueOnError)
+
+
+
+
+
+setMaxHistoryLength
+public void setMaxHistoryLength(int maxHistoryLength)
+
+
+
+
+
+addMacros
+public void addMacros(java.util.Map<java.lang.String,org.hsqldb.cmdline.sqltool.Token> newMacros)
+
+
+
+
+
+addUserVars
+public void addUserVars(java.util.Map<java.lang.String,java.lang.String> newUserVars)
+
+
+
+
+
+getUserVars
+public java.util.Map<java.lang.String,java.lang.String> getUserVars()
+
+
+
+
+
+
+
+getMacros
+public java.util.Map<java.lang.String,org.hsqldb.cmdline.sqltool.Token> getMacros()
+
+
+
+
+
+setAutoClose
+public void setAutoClose(boolean autoClose)
+
+
+autoClose
- boolean
+
+
+
+
+execute
+public void execute()
+ throws SqlToolError,
+ java.sql.SQLException
+
+
+java.sql.SQLException
- thrown by JDBC driver.
+ Only possible if in "\c false" mode.SqlToolError
- all other errors.
+ This includes QuitNow, BreakException,
+ ContinueException for recursive calls only.
+
+
+
+
+closeReader
+public void closeReader()
+
+
+
+
+
+getCurrentSchema
+public java.lang.String getCurrentSchema()
+ throws SqlFile.BadSpecial,
+ SqlToolError
+
+
+SqlFile.BadSpecial
SqlToolError
+
+
+
+
+streamToString
+public java.lang.String streamToString(java.io.InputStream is,
+ java.lang.String cs)
+ throws java.io.IOException
+
+
+is
- InputStreamcs
- Stringjava.io.IOException
- on read errors
+
+
+
+
+streamToBytes
+public static byte[] streamToBytes(java.io.InputStream is)
+ throws java.io.IOException
+
+
+is
- inputjava.io.IOException
- on read errors
+
+
+
+
+loadBinary
+public static byte[] loadBinary(java.io.File binFile)
+ throws java.io.IOException
+
+
+java.io.IOException
+
+
+
+
+loadBinary
+public static byte[] loadBinary(java.net.URL binUrl)
+ throws java.io.IOException
+
+
+binUrl
- urljava.io.IOException
- on read errors
+
+
+
+
+canDisplayType
+public static boolean canDisplayType(int i)
+
+
+i
- JDBC type numberTypes
+
+
+
+
+sqlTypeToString
+public static java.lang.String sqlTypeToString(int i)
+
+
+i
- int
+
+
+
+
+dsvSafe
+public void dsvSafe(java.lang.String s)
+ throws SqlToolError
+
+
+s
- StringSqlToolError
- if validation fails.
+
+
+
+
+convertEscapes
+public static java.lang.String convertEscapes(java.lang.String inString)
+
+
+
+ Java 1.4 String methods will make this into a 1 or 2 line task.
+
+inString
- input string
+
+
+
+
+importDsv
+public void importDsv(java.net.URL fileUrl,
+ java.lang.String skipPrefix)
+ throws SqlToolError
+
+
+fileUrl
- StringskipPrefix
- StringSqlToolError
- Would prefer to throw an internal exception,
+ but we want this method to have external
+ visibility.
+
+
+
+
+hexCharOctetsToBytes
+public static byte[] hexCharOctetsToBytes(java.lang.String hexChars)
+
+
+hexChars
- String
+
+
+
+
+bitCharsToBytes
+public static byte[] bitCharsToBytes(java.lang.String hexChars)
+
+
+hexChars
- String
+
+
+
+
+getBanner
+public static java.lang.String getBanner(java.sql.Connection c)
+
+
+c
- Connection
+
+
+
+
+escapeHtml
+public static java.lang.String escapeHtml(java.lang.String s)
+
+
+s
- String
+
+toPaddedString
+public static java.lang.String toPaddedString(java.lang.String source,
+ int length,
+ char pad,
+ boolean trailing)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+java.io.Serializable
+public class SqlToolError
+extends org.hsqldb.cmdline.libclone.AppendableException
+
+
+
+
+
+
+Constructor Summary
+
+
+
+
+Constructor
+Description
+
+
+
+SqlToolError()
+
+
+
+SqlToolError(java.lang.String s)
+
+
+
+SqlToolError(java.lang.String string,
+ java.lang.Throwable cause)
+
+
+
+SqlToolError(java.lang.Throwable cause)
+
+
+Method Summary
+
+
+Methods inherited from class org.hsqldb.cmdline.libclone.AppendableException
+appendMessage, getMessage
+
+Methods inherited from class java.lang.Throwable
+addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+Constructor Detail
+
+
+
+
+
+
+
+
+SqlToolError
+public SqlToolError(java.lang.Throwable cause)
+
+
+
+
+
+SqlToolError
+public SqlToolError()
+
+
+
+
+
+SqlToolError
+public SqlToolError(java.lang.String s)
+
+
+SqlToolError
+public SqlToolError(java.lang.String string,
+ java.lang.Throwable cause)
+
+
+
+
+
+
+
+public class SqlTool
+extends java.lang.Object
+src/org/hsqldb/sample/SqlFileEmbedder.java
+ in the HSQLDB distribution provides an example for this latter strategy.
+
+main(String[])
,
+objectMain(String[])
,
+SqlFile
+
+
+
+Nested Class Summary
+
+
+
+
+Modifier and Type
+Class
+Description
+
+
+
+static class
+SqlTool.SqlToolException
+
+
+Field Summary
+
+
+
+
+Modifier and Type
+Field
+Description
+
+
+
+static int
+CONNECTERR_EXITVAL
+
+
+
+static java.lang.String
+DEFAULT_RCFILE
+
+
+
+static int
+FILEERR_EXITVAL
+
+
+
+static int
+INPUTERR_EXITVAL
+
+
+
+static int
+IOERR_EXITVAL
+
+
+
+static java.lang.String
+LS
+
+
+
+
+static int
+RCERR_EXITVAL
+
+
+
+static int
+SQLERR_EXITVAL
+
+
+
+static int
+SQLTOOLERR_EXITVAL
+
+
+
+static int
+SYNTAXERR_EXITVAL
+
+
+Method Summary
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+static void
+main(java.lang.String[] args)
+
+
+
+
+static void
+objectMain(java.lang.String[] arg)
+
+
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+Field Detail
+
+
+
+
+
+
+
+
+DEFAULT_RCFILE
+public static final java.lang.String DEFAULT_RCFILE
+
+
+
+
+
+SQLTOOLERR_EXITVAL
+public static final int SQLTOOLERR_EXITVAL
+
+
+
+
+
+
+
+SYNTAXERR_EXITVAL
+public static final int SYNTAXERR_EXITVAL
+
+
+
+
+
+
+
+RCERR_EXITVAL
+public static final int RCERR_EXITVAL
+
+
+
+
+
+
+
+SQLERR_EXITVAL
+public static final int SQLERR_EXITVAL
+
+
+
+
+
+
+
+IOERR_EXITVAL
+public static final int IOERR_EXITVAL
+
+
+
+
+
+
+
+FILEERR_EXITVAL
+public static final int FILEERR_EXITVAL
+
+
+
+
+
+
+
+INPUTERR_EXITVAL
+public static final int INPUTERR_EXITVAL
+
+
+
+
+
+
+
+CONNECTERR_EXITVAL
+public static final int CONNECTERR_EXITVAL
+
+
+
+
+LS
+public static final java.lang.String LS
+
+
+Method Detail
+
+
+
+
+
+
+
+
+main
+public static void main(java.lang.String[] args)
+
+
+args
- argumentsobjectMain(String[])
+
+objectMain
+public static void objectMain(java.lang.String[] arg)
+ throws SqlTool.SqlToolException
+
+
+arg
- Run "java... org.hsqldb.cmdline.SqlTool --help" for syntax.SqlTool.SqlToolException
- Upon any fatal error, with useful
+ reason as the exception's message.
+
+
+
+
+
+
+
+
+
+java.io.Serializable
, java.lang.Comparable<SqltoolRB>
, org.hsqldb.cmdline.libclone.RefCapableRBInterface
+public enum SqltoolRB
+extends java.lang.Enum<SqltoolRB>
+implements org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+Enum Constant Summary
+
+
+Method Summary
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+java.lang.String
+getExpandedString()
+
+
+
+java.lang.String
+getExpandedString(java.lang.String... strings)
+
+
+
+java.lang.String
+getString()
+
+
+
+java.lang.String
+getString(int i1)
+
+
+
+java.lang.String
+getString(int i1,
+ int i2)
+
+
+
+java.lang.String
+getString(int i1,
+ int i2,
+ int i3)
+
+
+
+java.lang.String
+getString(int i1,
+ int i2,
+ java.lang.String s3)
+
+
+
+java.lang.String
+getString(int i1,
+ java.lang.String s2)
+
+
+
+java.lang.String
+getString(int i1,
+ java.lang.String s2,
+ int i3)
+
+
+
+java.lang.String
+getString(int i1,
+ java.lang.String s2,
+ java.lang.String s3)
+
+
+
+java.lang.String
+getString(java.lang.String... strings)
+
+
+
+java.lang.String
+getString(java.lang.String s1,
+ int i2)
+
+
+
+java.lang.String
+getString(java.lang.String s1,
+ int i2,
+ int i3)
+
+
+
+java.lang.String
+getString(java.lang.String s1,
+ int i2,
+ java.lang.String s3)
+
+
+
+java.lang.String
+getString(java.lang.String s1,
+ java.lang.String s2,
+ int i3)
+
+
+
+java.lang.String
+getString(java.lang.Throwable t)
+
+
+
+java.lang.String
+toString()
+
+
+
+static SqltoolRB
+valueOf(java.lang.String name)
+
+
+
+
+static SqltoolRB[]
+values()
+
+
+
+Methods inherited from class java.lang.Enum
+compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
+
+Methods inherited from class java.lang.Object
+getClass, notify, notifyAll, wait, wait, wait
+
+
+
+Enum Constant Detail
+
+
+
+
+
+
+
+
+SqlTool_syntax
+public static final SqltoolRB SqlTool_syntax
+
+
+
+
+
+passwordFor_prompt
+public static final SqltoolRB passwordFor_prompt
+
+
+
+
+
+SqlTool_varset_badformat
+public static final SqltoolRB SqlTool_varset_badformat
+
+
+
+
+
+SqlTool_abort_continue_mutuallyexclusive
+public static final SqltoolRB SqlTool_abort_continue_mutuallyexclusive
+
+
+
+
+
+sqltempfile_fail
+public static final SqltoolRB sqltempfile_fail
+
+
+
+
+
+rcdata_inlineurl_missing
+public static final SqltoolRB rcdata_inlineurl_missing
+
+
+
+
+
+rcdata_inline_extravars
+public static final SqltoolRB rcdata_inline_extravars
+
+
+
+
+
+rcdata_driver_conflict
+public static final SqltoolRB rcdata_driver_conflict
+
+
+
+
+
+rcdata_password_visible
+public static final SqltoolRB rcdata_password_visible
+
+
+
+
+
+password_readfail
+public static final SqltoolRB password_readfail
+
+
+
+
+
+connection_fail
+public static final SqltoolRB connection_fail
+
+
+
+
+
+rcdata_genfromvalues_fail
+public static final SqltoolRB rcdata_genfromvalues_fail
+
+
+
+
+
+conndata_retrieval_fail
+public static final SqltoolRB conndata_retrieval_fail
+
+
+
+
+
+jdbc_established
+public static final SqltoolRB jdbc_established
+
+
+
+
+
+SqlTool_params_redundant
+public static final SqltoolRB SqlTool_params_redundant
+
+
+
+
+
+SqlFile_banner
+public static final SqltoolRB SqlFile_banner
+
+
+
+
+
+buffer_help
+public static final SqltoolRB buffer_help
+
+
+
+
+
+special_help
+public static final SqltoolRB special_help
+
+
+
+
+
+pl_help
+public static final SqltoolRB pl_help
+
+
+
+
+
+pl_control
+public static final SqltoolRB pl_control
+
+
+
+
+
+pl_assign
+public static final SqltoolRB pl_assign
+
+
+
+
+
+dsv_options
+public static final SqltoolRB dsv_options
+
+
+
+
+
+d_options
+public static final SqltoolRB d_options
+
+
+
+
+
+raw_leadin
+public static final SqltoolRB raw_leadin
+
+
+
+
+
+errorat
+public static final SqltoolRB errorat
+
+
+
+
+
+rejectreport_top
+public static final SqltoolRB rejectreport_top
+
+
+
+
+
+rejectreport_row
+public static final SqltoolRB rejectreport_row
+
+
+
+
+
+rejectreport_bottom
+public static final SqltoolRB rejectreport_bottom
+
+
+
+
+
+macro_help
+public static final SqltoolRB macro_help
+
+
+
+
+
+rawmode_prompt
+public static final SqltoolRB rawmode_prompt
+
+
+
+
+
+raw_movedtobuffer
+public static final SqltoolRB raw_movedtobuffer
+
+
+
+
+
+input_movedtobuffer
+public static final SqltoolRB input_movedtobuffer
+
+
+
+
+
+sqlstatement_empty
+public static final SqltoolRB sqlstatement_empty
+
+
+
+
+
+causereport
+public static final SqltoolRB causereport
+
+
+
+
+
+break_unsatisfied
+public static final SqltoolRB break_unsatisfied
+
+
+
+
+
+continue_unsatisfied
+public static final SqltoolRB continue_unsatisfied
+
+
+
+
+
+primaryinput_accessfail
+public static final SqltoolRB primaryinput_accessfail
+
+
+
+
+
+input_unterminated
+public static final SqltoolRB input_unterminated
+
+
+
+
+
+plvar_set_incomplete
+public static final SqltoolRB plvar_set_incomplete
+
+
+
+
+
+aborting
+public static final SqltoolRB aborting
+
+
+
+
+
+rollingback
+public static final SqltoolRB rollingback
+
+
+
+
+
+special_unspecified
+public static final SqltoolRB special_unspecified
+
+
+
+
+
+bufhist_unspecified
+public static final SqltoolRB bufhist_unspecified
+
+
+
+
+
+buffer_executing
+public static final SqltoolRB buffer_executing
+
+
+
+
+
+nobuffer_yet
+public static final SqltoolRB nobuffer_yet
+
+
+
+
+
+commandnum_malformat
+public static final SqltoolRB commandnum_malformat
+
+
+
+
+
+buffer_restored
+public static final SqltoolRB buffer_restored
+
+
+
+
+
+substitution_malformat
+public static final SqltoolRB substitution_malformat
+
+
+
+
+
+substitution_nomatch
+public static final SqltoolRB substitution_nomatch
+
+
+
+
+
+substitution_syntax
+public static final SqltoolRB substitution_syntax
+
+
+
+
+
+buffer_unknown
+public static final SqltoolRB buffer_unknown
+
+
+
+
+
+special_extrachars
+public static final SqltoolRB special_extrachars
+
+
+
+
+
+buffer_extrachars
+public static final SqltoolRB buffer_extrachars
+
+
+
+
+
+special_malformat
+public static final SqltoolRB special_malformat
+
+
+
+
+
+html_mode
+public static final SqltoolRB html_mode
+
+
+
+
+
+dsv_targetfile_demand
+public static final SqltoolRB dsv_targetfile_demand
+
+
+
+
+
+file_wrotechars
+public static final SqltoolRB file_wrotechars
+
+
+
+
+
+file_writefail
+public static final SqltoolRB file_writefail
+
+
+
+
+
+special_d_like
+public static final SqltoolRB special_d_like
+
+
+
+
+
+outputfile_nonetoclose
+public static final SqltoolRB outputfile_nonetoclose
+
+
+
+
+
+outputfile_reopening
+public static final SqltoolRB outputfile_reopening
+
+
+
+
+
+outputfile_header
+public static final SqltoolRB outputfile_header
+
+
+
+
+
+destfile_demand
+public static final SqltoolRB destfile_demand
+
+
+
+
+
+buffer_empty
+public static final SqltoolRB buffer_empty
+
+
+
+
+
+file_appendfail
+public static final SqltoolRB file_appendfail
+
+
+
+
+
+sqlfile_name_demand
+public static final SqltoolRB sqlfile_name_demand
+
+
+
+
+
+sqlfile_execute_fail
+public static final SqltoolRB sqlfile_execute_fail
+
+
+
+
+
+a_setting
+public static final SqltoolRB a_setting
+
+
+
+
+
+committed
+public static final SqltoolRB committed
+
+
+
+
+
+special_b_malformat
+public static final SqltoolRB special_b_malformat
+
+
+
+
+
+binary_loadedbytesinto
+public static final SqltoolRB binary_loadedbytesinto
+
+
+
+
+
+binary_filefail
+public static final SqltoolRB binary_filefail
+
+
+
+
+
+c_setting
+public static final SqltoolRB c_setting
+
+
+
+
+
+bang_incomplete
+public static final SqltoolRB bang_incomplete
+
+
+
+
+
+bang_command_fail
+public static final SqltoolRB bang_command_fail
+
+
+
+
+
+special_unknown
+public static final SqltoolRB special_unknown
+
+
+
+
+
+dsv_m_syntax
+public static final SqltoolRB dsv_m_syntax
+
+
+
+
+
+dsv_x_syntax
+public static final SqltoolRB dsv_x_syntax
+
+
+
+
+
+raw_empty
+public static final SqltoolRB raw_empty
+
+
+
+
+
+dsv_nocolsleft
+public static final SqltoolRB dsv_nocolsleft
+
+
+
+
+
+dsv_skipcols_missing
+public static final SqltoolRB dsv_skipcols_missing
+
+
+
+
+
+plalias_malformat
+public static final SqltoolRB plalias_malformat
+
+
+
+
+
+plvar_undefined
+public static final SqltoolRB plvar_undefined
+
+
+
+
+
+sysprop_empty
+public static final SqltoolRB sysprop_empty
+
+
+
+
+
+sysprop_unterminated
+public static final SqltoolRB sysprop_unterminated
+
+
+
+
+
+sysprop_undefined
+public static final SqltoolRB sysprop_undefined
+
+
+
+
+
+var_infinite
+public static final SqltoolRB var_infinite
+
+
+
+
+
+plvar_nameempty
+public static final SqltoolRB plvar_nameempty
+
+
+
+
+
+plvar_unterminated
+public static final SqltoolRB plvar_unterminated
+
+
+
+
+
+pl_malformat
+public static final SqltoolRB pl_malformat
+
+
+
+
+
+deprecated_noop
+public static final SqltoolRB deprecated_noop
+
+
+
+
+
+end_noblock
+public static final SqltoolRB end_noblock
+
+
+
+
+
+continue_syntax
+public static final SqltoolRB continue_syntax
+
+
+
+
+
+break_syntax
+public static final SqltoolRB break_syntax
+
+
+
+
+
+pl_list_parens
+public static final SqltoolRB pl_list_parens
+
+
+
+
+
+pl_list_lengths
+public static final SqltoolRB pl_list_lengths
+
+
+
+
+
+dumpload_malformat
+public static final SqltoolRB dumpload_malformat
+
+
+
+
+
+plvar_nocolon
+public static final SqltoolRB plvar_nocolon
+
+
+
+
+
+plvar_tildedash_nomoreargs
+public static final SqltoolRB plvar_tildedash_nomoreargs
+
+
+
+
+
+dumpload_fail
+public static final SqltoolRB dumpload_fail
+
+
+
+
+
+pl_malformat_specific
+public static final SqltoolRB pl_malformat_specific
+
+
+
+
+
+pl_block_fail
+public static final SqltoolRB pl_block_fail
+
+
+
+
+
+ifwhile_malformat
+public static final SqltoolRB ifwhile_malformat
+
+
+
+
+
+pl_unknown
+public static final SqltoolRB pl_unknown
+
+
+
+
+
+pl_block_unterminated
+public static final SqltoolRB pl_block_unterminated
+
+
+
+
+
+vendor_oracle_dS
+public static final SqltoolRB vendor_oracle_dS
+
+
+
+
+
+vendor_derby_dr
+public static final SqltoolRB vendor_derby_dr
+
+
+
+
+
+vendor_nosup_d
+public static final SqltoolRB vendor_nosup_d
+
+
+
+
+
+vendor_derby_du
+public static final SqltoolRB vendor_derby_du
+
+
+
+
+
+special_d_unknown
+public static final SqltoolRB special_d_unknown
+
+
+
+
+
+metadata_fetch_fail
+public static final SqltoolRB metadata_fetch_fail
+
+
+
+
+
+metadata_fetch_failfor
+public static final SqltoolRB metadata_fetch_failfor
+
+
+
+
+
+prepare_demandqm
+public static final SqltoolRB prepare_demandqm
+
+
+
+
+
+binbuffer_empty
+public static final SqltoolRB binbuffer_empty
+
+
+
+
+
+vendor_nosup_sysschemas
+public static final SqltoolRB vendor_nosup_sysschemas
+
+
+
+
+
+noresult
+public static final SqltoolRB noresult
+
+
+
+
+
+dsv_bincol
+public static final SqltoolRB dsv_bincol
+
+
+
+
+
+binbuf_write
+public static final SqltoolRB binbuf_write
+
+
+
+
+
+rows_fetched
+public static final SqltoolRB rows_fetched
+
+
+
+
+
+rows_fetched_dsv
+public static final SqltoolRB rows_fetched_dsv
+
+
+
+
+
+row_update_singular
+public static final SqltoolRB row_update_singular
+
+
+
+
+
+row_update_multiple
+public static final SqltoolRB row_update_multiple
+
+
+
+
+
+history_unavailable
+public static final SqltoolRB history_unavailable
+
+
+
+
+
+history_none
+public static final SqltoolRB history_none
+
+
+
+
+
+editbuffer_contents
+public static final SqltoolRB editbuffer_contents
+
+
+
+
+
+buffer_instructions
+public static final SqltoolRB buffer_instructions
+
+
+
+
+
+history_number_req
+public static final SqltoolRB history_number_req
+
+
+
+
+
+history_backto
+public static final SqltoolRB history_backto
+
+
+
+
+
+history_upto
+public static final SqltoolRB history_upto
+
+
+
+
+
+history_back
+public static final SqltoolRB history_back
+
+
+
+
+
+describe_table_name
+public static final SqltoolRB describe_table_name
+
+
+
+
+
+describe_table_datatype
+public static final SqltoolRB describe_table_datatype
+
+
+
+
+
+describe_table_width
+public static final SqltoolRB describe_table_width
+
+
+
+
+
+describe_table_nonulls
+public static final SqltoolRB describe_table_nonulls
+
+
+
+
+
+describe_table_precision
+public static final SqltoolRB describe_table_precision
+
+
+
+
+
+describe_table_scale
+public static final SqltoolRB describe_table_scale
+
+
+
+
+
+logical_unrecognized
+public static final SqltoolRB logical_unrecognized
+
+
+
+
+
+read_toobig
+public static final SqltoolRB read_toobig
+
+
+
+
+
+read_partial
+public static final SqltoolRB read_partial
+
+
+
+
+
+read_convertfail
+public static final SqltoolRB read_convertfail
+
+
+
+
+
+dsv_coldelim_present
+public static final SqltoolRB dsv_coldelim_present
+
+
+
+
+
+dsv_rowdelim_present
+public static final SqltoolRB dsv_rowdelim_present
+
+
+
+
+
+dsv_nullrep_present
+public static final SqltoolRB dsv_nullrep_present
+
+
+
+
+
+dsv_constcols_nullcol
+public static final SqltoolRB dsv_constcols_nullcol
+
+
+
+
+
+file_readfail
+public static final SqltoolRB file_readfail
+
+
+
+
+
+inputfile_closefail
+public static final SqltoolRB inputfile_closefail
+
+
+
+
+
+dsv_header_none
+public static final SqltoolRB dsv_header_none
+
+
+
+
+
+dsv_header_noswitchtarg
+public static final SqltoolRB dsv_header_noswitchtarg
+
+
+
+
+
+dsv_header_noswitchmatch
+public static final SqltoolRB dsv_header_noswitchmatch
+
+
+
+
+
+dsv_header_nonswitched
+public static final SqltoolRB dsv_header_nonswitched
+
+
+
+
+
+dsv_nocolheader
+public static final SqltoolRB dsv_nocolheader
+
+
+
+
+
+dsv_metadata_mismatch
+public static final SqltoolRB dsv_metadata_mismatch
+
+
+
+
+
+query_metadatafail
+public static final SqltoolRB query_metadatafail
+
+
+
+
+
+dsv_rejectfile_setupfail
+public static final SqltoolRB dsv_rejectfile_setupfail
+
+
+
+
+
+dsv_rejectreport_setupfail
+public static final SqltoolRB dsv_rejectreport_setupfail
+
+
+
+
+
+none
+public static final SqltoolRB none
+
+
+
+
+
+insertion_preparefail
+public static final SqltoolRB insertion_preparefail
+
+
+
+
+
+dsv_header_matchernonhead
+public static final SqltoolRB dsv_header_matchernonhead
+
+
+
+
+
+dsv_colcount_mismatch
+public static final SqltoolRB dsv_colcount_mismatch
+
+
+
+
+
+dsv_insertcol_mismatch
+public static final SqltoolRB dsv_insertcol_mismatch
+
+
+
+
+
+time_bad
+public static final SqltoolRB time_bad
+
+
+
+
+
+boolean_bad
+public static final SqltoolRB boolean_bad
+
+
+
+
+
+inputrec_modified
+public static final SqltoolRB inputrec_modified
+
+
+
+
+
+dsv_recin_fail
+public static final SqltoolRB dsv_recin_fail
+
+
+
+
+
+dsv_import_summary
+public static final SqltoolRB dsv_import_summary
+
+
+
+
+
+insertions_notcommitted
+public static final SqltoolRB insertions_notcommitted
+
+
+
+
+
+autocommit_fetchfail
+public static final SqltoolRB autocommit_fetchfail
+
+
+
+
+
+dsv_rejectfile_purgefail
+public static final SqltoolRB dsv_rejectfile_purgefail
+
+
+
+
+
+dsv_rejectreport_purgefail
+public static final SqltoolRB dsv_rejectreport_purgefail
+
+
+
+
+
+edit_malformat
+public static final SqltoolRB edit_malformat
+
+
+
+
+
+input_malformat
+public static final SqltoolRB input_malformat
+
+
+
+
+
+append_empty
+public static final SqltoolRB append_empty
+
+
+
+
+
+transiso_report
+public static final SqltoolRB transiso_report
+
+
+
+
+
+exectime_reporting
+public static final SqltoolRB exectime_reporting
+
+
+
+
+
+exectime_report
+public static final SqltoolRB exectime_report
+
+
+
+
+
+regex_malformat
+public static final SqltoolRB regex_malformat
+
+
+
+
+
+encode_fail
+public static final SqltoolRB encode_fail
+
+
+
+
+
+macro_tip
+public static final SqltoolRB macro_tip
+
+
+
+
+
+macrodef_malformat
+public static final SqltoolRB macrodef_malformat
+
+
+
+
+
+macrodef_empty
+public static final SqltoolRB macrodef_empty
+
+
+
+
+
+macrodef_semi
+public static final SqltoolRB macrodef_semi
+
+
+
+
+
+macro_malformat
+public static final SqltoolRB macro_malformat
+
+
+
+
+
+macro_undefined
+public static final SqltoolRB macro_undefined
+
+
+
+
+
+log_syntax
+public static final SqltoolRB log_syntax
+
+
+
+
+
+log_syntax_error
+public static final SqltoolRB log_syntax_error
+
+
+
+
+
+reject_rpc
+public static final SqltoolRB reject_rpc
+
+
+
+
+
+rpc_autocommit_failure
+public static final SqltoolRB rpc_autocommit_failure
+
+
+
+
+
+rpc_commit_failure
+public static final SqltoolRB rpc_commit_failure
+
+
+
+
+
+disconnect_success
+public static final SqltoolRB disconnect_success
+
+
+
+
+
+disconnect_failure
+public static final SqltoolRB disconnect_failure
+
+
+
+
+
+no_required_conn
+public static final SqltoolRB no_required_conn
+
+
+
+
+
+disconnected_msg
+public static final SqltoolRB disconnected_msg
+
+
+
+
+
+connected_fallbackmsg
+public static final SqltoolRB connected_fallbackmsg
+
+
+
+
+
+no_vendor_schemaspt
+public static final SqltoolRB no_vendor_schemaspt
+
+
+
+
+
+schemaname_retrieval_fail
+public static final SqltoolRB schemaname_retrieval_fail
+
+
+
+
+
+remove_empty_vars_suggestset
+public static final SqltoolRB remove_empty_vars_suggestset
+
+
+
+
+
+auto_unset_warning
+public static final SqltoolRB auto_unset_warning
+
+
+
+
+
+pl_unset_nomoreargs
+public static final SqltoolRB pl_unset_nomoreargs
+
+
+
+
+
+dsv_q_nodblquote
+public static final SqltoolRB dsv_q_nodblquote
+
+
+
+
+
+connect_failure
+public static final SqltoolRB connect_failure
+
+
+
+
+
+streamread_failure
+public static final SqltoolRB streamread_failure
+
+
+
+
+
+illegal_at
+public static final SqltoolRB illegal_at
+
+
+
+
+
+suggest_j
+public static final SqltoolRB suggest_j
+
+
+
+
+
+pipeclose_failure
+public static final SqltoolRB pipeclose_failure
+
+
+
+
+
+arrayimp_jvmreq
+public static final SqltoolRB arrayimp_jvmreq
+
+
+
+
+
+arrayval_malformat
+public static final SqltoolRB arrayval_malformat
+
+
+
+
+
+sqlarray_badjvm
+public static final SqltoolRB sqlarray_badjvm
+
+
+
+
+
+csv_coldelim_present
+public static final SqltoolRB csv_coldelim_present
+
+
+
+
+
+csv_quote_unterminated
+public static final SqltoolRB csv_quote_unterminated
+
+
+
+
+
+math_expr_fail
+public static final SqltoolRB math_expr_fail
+
+
+
+
+
+varname_warning
+public static final SqltoolRB varname_warning
+
+
+
+
+
+null_assignment
+public static final SqltoolRB null_assignment
+
+
+
+
+
+bad_time_format
+public static final SqltoolRB bad_time_format
+
+
+
+
+
+no_timestamp_format
+public static final SqltoolRB no_timestamp_format
+
+
+
+
+
+else_without_if
+public static final SqltoolRB else_without_if
+
+
+
+
+
+import_col_dup
+public static final SqltoolRB import_col_dup
+
+
+desturl_nowrite
+public static final SqltoolRB desturl_nowrite
+
+
+Method Detail
+
+
+
+
+
+
+
+
+values
+public static SqltoolRB[] values()
+
+for (SqltoolRB c : SqltoolRB.values())
+ System.out.println(c);
+
+
+
+
+
+
+
+valueOf
+public static SqltoolRB valueOf(java.lang.String name)
+
+
+name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
+
+
+
+
+getString
+public java.lang.String getString()
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+toString
+public java.lang.String toString()
+
+
+toString
in class java.lang.Enum<SqltoolRB>
+
+
+
+
+getExpandedString
+public java.lang.String getExpandedString()
+
+
+getExpandedString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getExpandedString
+public java.lang.String getExpandedString(java.lang.String... strings)
+
+
+getExpandedString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(java.lang.Throwable t)
+
+
+
+
+
+getString
+public java.lang.String getString(java.lang.String... strings)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1,
+ int i2)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1,
+ int i2,
+ int i3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1,
+ java.lang.String s2)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(java.lang.String s1,
+ int i2)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1,
+ int i2,
+ java.lang.String s3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1,
+ java.lang.String s2,
+ int i3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(java.lang.String s1,
+ int i2,
+ int i3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(int i1,
+ java.lang.String s2,
+ java.lang.String s3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+getString
+public java.lang.String getString(java.lang.String s1,
+ java.lang.String s2,
+ int i3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+getString
+public java.lang.String getString(java.lang.String s1,
+ int i2,
+ java.lang.String s3)
+
+
+getString
in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
+
+
+
+
+
+
+public class SqlToolSprayer
+extends java.lang.Object
+
+
+
+main(String[])
+
+
+
+Constructor Summary
+
+
+
+
+Constructor
+Description
+
+
+
+SqlToolSprayer()
+
+
+Method Summary
+
+
+
+
+Modifier and Type
+Method
+Description
+
+
+
+static void
+main(java.lang.String[] sa)
+
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+
+
+
+
+
+
+java.io.Serializable
+
+
+public static class SqlTool.SqlToolException
+extends java.lang.Exception
+
+
+
+
+
+
+Method Summary
+
+
+Methods inherited from class java.lang.Throwable
+addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Class Hierarchy
+
+
+
+
+
+
+
+
+
+
+Enum Hierarchy
+
+
+
+
+
+
+
"
+ + item.d + "
");
+ } else {
+ div.html(label + " (" + item.h + ")");
+ }
+ } else {
+ div.html(label);
+ }
+ return li;
+ }
+});
+$(function() {
+ $("#search").catcomplete({
+ minLength: 1,
+ delay: 100,
+ source: function(request, response) {
+ var result = new Array();
+ var presult = new Array();
+ var tresult = new Array();
+ var mresult = new Array();
+ var tgresult = new Array();
+ var secondaryresult = new Array();
+ var displayCount = 0;
+ var exactMatcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term) + "$", "i");
+ camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join("([a-z0-9_$]*?)");
+ var camelCaseMatcher = new RegExp("^" + camelCaseRegexp);
+ secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
+
+ // Return the nested innermost name from the specified object
+ function nestedName(e) {
+ return e.l.substring(e.l.lastIndexOf(".") + 1);
+ }
+
+ function concatResults(a1, a2) {
+ a1 = a1.concat(a2);
+ a2.length = 0;
+ return a1;
+ }
+
+ if (moduleSearchIndex) {
+ var mdleCount = 0;
+ $.each(moduleSearchIndex, function(index, item) {
+ item.category = catModules;
+ if (exactMatcher.test(item.l)) {
+ result.push(item);
+ mdleCount++;
+ } else if (camelCaseMatcher.test(item.l)) {
+ result.push(item);
+ } else if (secondaryMatcher.test(item.l)) {
+ secondaryresult.push(item);
+ }
+ });
+ displayCount = mdleCount;
+ result = concatResults(result, secondaryresult);
+ }
+ if (packageSearchIndex) {
+ var pCount = 0;
+ var pkg = "";
+ $.each(packageSearchIndex, function(index, item) {
+ item.category = catPackages;
+ pkg = (item.m)
+ ? (item.m + "/" + item.l)
+ : item.l;
+ if (exactMatcher.test(item.l)) {
+ presult.push(item);
+ pCount++;
+ } else if (camelCaseMatcher.test(pkg)) {
+ presult.push(item);
+ } else if (secondaryMatcher.test(pkg)) {
+ secondaryresult.push(item);
+ }
+ });
+ result = result.concat(concatResults(presult, secondaryresult));
+ displayCount = (pCount > displayCount) ? pCount : displayCount;
+ }
+ if (typeSearchIndex) {
+ var tCount = 0;
+ $.each(typeSearchIndex, function(index, item) {
+ item.category = catTypes;
+ var s = nestedName(item);
+ if (exactMatcher.test(s)) {
+ tresult.push(item);
+ tCount++;
+ } else if (camelCaseMatcher.test(s)) {
+ tresult.push(item);
+ } else if (secondaryMatcher.test(item.p + "." + item.l)) {
+ secondaryresult.push(item);
+ }
+ });
+ result = result.concat(concatResults(tresult, secondaryresult));
+ displayCount = (tCount > displayCount) ? tCount : displayCount;
+ }
+ if (memberSearchIndex) {
+ var mCount = 0;
+ $.each(memberSearchIndex, function(index, item) {
+ item.category = catMembers;
+ var s = nestedName(item);
+ if (exactMatcher.test(s)) {
+ mresult.push(item);
+ mCount++;
+ } else if (camelCaseMatcher.test(s)) {
+ mresult.push(item);
+ } else if (secondaryMatcher.test(item.c + "." + item.l)) {
+ secondaryresult.push(item);
+ }
+ });
+ result = result.concat(concatResults(mresult, secondaryresult));
+ displayCount = (mCount > displayCount) ? mCount : displayCount;
+ }
+ if (tagSearchIndex) {
+ var tgCount = 0;
+ $.each(tagSearchIndex, function(index, item) {
+ item.category = catSearchTags;
+ if (exactMatcher.test(item.l)) {
+ tgresult.push(item);
+ tgCount++;
+ } else if (secondaryMatcher.test(item.l)) {
+ secondaryresult.push(item);
+ }
+ });
+ result = result.concat(concatResults(tgresult, secondaryresult));
+ displayCount = (tgCount > displayCount) ? tgCount : displayCount;
+ }
+ displayCount = (displayCount > 500) ? displayCount : 500;
+ var counter = function() {
+ var count = {Modules: 0, Packages: 0, Types: 0, Members: 0, SearchTags: 0};
+ var f = function(item) {
+ count[item.category] += 1;
+ return (count[item.category] <= displayCount);
+ };
+ return f;
+ }();
+ response(result.filter(counter));
+ },
+ response: function(event, ui) {
+ if (!ui.content.length) {
+ ui.content.push(noResult);
+ } else {
+ $("#search").empty();
+ }
+ },
+ autoFocus: true,
+ position: {
+ collision: "flip"
+ },
+ select: function(event, ui) {
+ if (ui.item.l !== noResult.l) {
+ var url = getURLPrefix(ui);
+ if (ui.item.category === catModules) {
+ if (useModuleDirectories) {
+ url += "module-summary.html";
+ } else {
+ url = ui.item.l + "-summary.html";
+ }
+ } else if (ui.item.category === catPackages) {
+ if (ui.item.url) {
+ url = ui.item.url;
+ } else {
+ url += ui.item.l.replace(/\./g, '/') + "/package-summary.html";
+ }
+ } else if (ui.item.category === catTypes) {
+ if (ui.item.url) {
+ url = ui.item.url;
+ } else if (ui.item.p === "Serialized Form
+
+
+Package org.hsqldb.cmdline
+
+
+Class org.hsqldb.cmdline.SqlFile.BadSpecial extends org.hsqldb.cmdline.libclone.AppendableException implements Serializable
+
+
+Class org.hsqldb.cmdline.SqlTool.SqlToolException extends java.lang.Exception implements Serializable
+
+
+
+
+Serialized Fields
+
+
+exitValue
+int exitValue
+Class org.hsqldb.cmdline.SqlToolError extends org.hsqldb.cmdline.libclone.AppendableException implements Serializable
+
+
+
Authorization names are stored in the database in case-normal form. + When a user is created with the CREATE USER statement, if the user name is + enclosed in double quotes, the exact name is used as the case-normal form. + But if it is not enclosed in double quotes, the name is converted to + uppercase and this uppercase version is stored in the database as the + case-normal form. When connecting to a database via JDBC, the user name + and password must match the case of the stored form.
+Each database has at least one admin user. When the first connection
+ to a non-existent database is made, the admin user is created with the the
+ user name for the connection. The user name SA
is
+ suggested in the documentation but you can use any name.
In general, ROLE and USER objects simply control access to schema - objects. This is the scope of the SQL Standard. However, there are special - roles that allow the creation of USER and ROLE objects and also allow some - special operations on the database as a whole. These roles are not defined - by the Standard, which has left it to implementers to define such roles as - they are needed for the particular SQL implementation.
+ objects. There is the built-in DBA role that allows full access to all + possible operations on the database, including the creation of USER and + ROLE objects and schemas. There are other built-in roles that allow some + special operations on the database as a whole. Admin users have the DBA + role.A ROLE has a name, a collection of zero or more other roles, plus some privileges (access rights). A USER has a name and a password. It similarly has a collection of zero or more roles plus some privileges.
-USER objects existed in the SQL-92, but ROLE objects were introduced - in SQL:1999. Originally it was intended that USER objects would normally - be the same as the operating system USER objects and their authentication - would be handled outside the SQL environment. The co-existence of ROLE and - USER objects results in complexity. With the addition of ROLE objects, - there is no rationale, other than legacy support, for granting privileges - to USER objects directly. It is better to create roles and grant - privileges to them, then grant the roles to USER objects.
+USER objects existed in SQL-92, but ROLE objects were introduced in + SQL:1999. The co-existence of ROLE and USER objects results in complexity. + With the addition of ROLE objects, there is no rationale, other than + legacy support, for granting privileges to USER objects directly. It is + better to create roles and grant privileges to them, then grant the roles + to USER objects.
The Standard effectively defines a special ROLE, named PUBLIC. All authorizations have the PUBLIC role, which cannot be removed from them. Therefore, any access right assigned to the PUBLIC role applies to all authorizations in the database. For many simple databases, it is adequate - to create a single, non-admin user, then assign access rights to the - pre-existing PUBLIC role. Access to INFORMATION_SCHEMA views is granted to + to create one or more non-admin user, then assign access rights to the + tables and sequences to the PUBLIC role.
+The PUBLIC role is separate from the default PUBLIC schema. The + contents of this schema is not visible to non-admin users unless access is + granted by the DBA role.
+Access to INFORMATION_SCHEMA views is automatically granted to PUBLIC; therefore these views are accessible to all. However, the contents of each view depend on the ROLE or USER (AUTHORIZATION) that is in force - while accessing the view.
+ while accessing the view. This means a user cannot even see the existence + of tables and other objects when it has no access rights on those + objects.Each schema has a single AUTHORIZATION. This is commonly known as the owner of the schema. All the objects in the schema inherit the schema owner. The schema owner can add objects to the - schema, drop them or alter them.
-By default, the objects in a schema can only be accessed by the - schema owner. The schema owner can grant access rights on the objects to - other users or roles.
- + schema, drop them or alter them. By default, the objects in a schema can + only be accessed by the schema owner. The schema owner can grant access + rights on the objects to other users or roles. +authorization identifier @@ -188,29 +198,31 @@ +
There are some pre-defined roles in each database; some defined by the SQL Standard, some by HyperSQL. These roles can be assigned to users (directly or via other, user-defined roles). In addition, there is the - initial SYS user created with each new database. The initial user name + initial admin user created with each new database. The initial user name and password is defined in the connection properties when the first connection to the database is made. In older versions of HSQLDB, this name was always SA. But in the latest version, the name can be defined as a different string.
- +-SYS User +Admin User
-the SYS user (HyperSQL-specific) +the Admin user + (HyperSQL-specific)
This user is automatically created with a new database and has the DBA role. This user name and its password are defined in the connection properties when connecting to the new database to create the - database. As this user, it is possible to change the password, create - other users and created new schema objects. The initial SYS user can be + database. This user can change the password, create other users and + create new schemas and other objects. The initial admin user can be dropped by another user that has the DBA role. As a result, there is - always at least one SYS user in the database.
- + always at least one admin user in the database. +PUBLIC
@@ -222,7 +234,7 @@ the INFORMATION_SCHEMA with limited visibility. Any roles or rights granted to this role, are in effect granted to all users of the database. - +_SYSTEM
@@ -232,7 +244,7 @@This role is the authorization for the pre-defined (system) objects in the database, including the INFORMATION_SCHEMA. This role cannot be assigned to any authorization (user or role).
- +DBA
@@ -244,8 +256,9 @@ role can also act as a proxy for all the roles and users in the database. This means it can do everything the authorization for a schema can do, including dropping the schema or its objects, or granting rights - on the schema objects to a grantee. - + on the schema objects to a grantee. All admin users have this + role. +CREATE_SCHEMA
@@ -256,7 +269,7 @@An authorization that has this role, can create schemas. The DBA authorization has this role and can grant it to other authorizations.
- +CHANGE_AUTHORIZATION
@@ -269,7 +282,7 @@ (otherwise, the original user would gain DBA privileges). The DBA authorization has this role and can grant it to other authorizations. - +SCRIPT_OPS
@@ -290,8 +303,10 @@ +Tables in the INFORMATION_SCHEMA contain the list of users and - roles for the database.
+ roles for the database. Only admin users can see the full contents of + these tables.The SYSTEM_USERS tables contains the list of users, with some extra settings for each user. The AUTHORIZATIONS table contains a list of both users and roles.
@@ -314,10 +329,19 @@ -By default, the objects in a schema can only be accessed by the - schema owner. But the schema owner can grant privileges (access rights) - on the objects to other users or roles.
-Things can get far more complex, because the grant of privileges + +
The create schema statements has an optional AUTHORIZATION clause: + For example:
+CREATE SCHEMA mySchema AUTHORIZATION aUserOrRole ++
If the authorization is not specified, the DBA role becomes the + authorization. This authorization is the owner of the schema. By + default, the objects in a schema can only be accessed by the schema + owner. But the schema owner can grant privileges (access rights) on the + objects to other users or roles.
+Things can get far more complex because the grant of privileges can be made WITH GRANT OPTION. In this case, the role or user that has been granted the privilege can grant the privilege to other roles and users.
@@ -325,9 +349,9 @@The statements for granting and revoking privileges normally
specify which privileges are granted or revoked. However, there is a
shortcut, ALL PRIVILEGES, which means all the privileges that the
- <grantor>
has on the schema object. The
- <grantor>
is normally the CURRENT_USER of the
- session that issues the statement.
<grantor>
has on the specified schema object.
+ The <grantor>
is normally the CURRENT_USER of
+ the session that issues the statement.
The user or role that is granted privileges is referred to as
<grantee>
for the granted privileges.
@@ -385,16 +409,75 @@
+ + +The simplest form of access control is when the DBA user creates a + single non-admin user, then creates the tables and other objects in the + PUBLIC schema, and grants access to the objects to PUBLIC. A grant to + PUBLIC applies to all non-admin users, including any users that are + created later.
+CREATE USER generalUser PASSWORD 'aPassword' + +-- the objects are created one by one in the PUBLIC schema +SET SCHEMA PUBLIC +CREATE TABLE aTable ... +CREATE TABLE anotherTable ... +... +CREATE SEQUENCE aSequence ... +CREATE PROCECURE aProc ... +''' + +-- access rights are granted to PUBLIC, which includes the generalUser +GRANT ALL ON ALL TABLES IN SCHEMA public TO PUBLIC +GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO PUBLIC +GRANT ALL ON ALL ROUTINES IN SCHEMA public TO PUBLIC ++
When different users need to have different levels of access, the + privileges are granted to individual users as opposed to PUBLIC. In the + example below there are 2 users with different access rights to the + objects in the schema.
+-- two users are created first +CREATE USER generalUser PASSWORD 'aPassword' +CREATE USER auditUser PASSWORD 'anotherPassword' + +-- the schema and its objects are created with a single compound statement +CREATE SCHEMA mySchema AUTHORIZATION DBA + CREATE TABLE aTable ... + CREATE TABLE anotherTable ... + ... + CREATE SEQUENCE aSequence ... + CREATE PROCECURE aProc ... + '''; + +-- different access rights are granted to the users +GRANT ALL ON ALL TABLES IN SCHEMA mySchema TO generalUser +GRANT USAGE ON ALL SEQUENCES IN SCHEMA mySchema TO generalUser +GRANT EXECUTE ON ALL ROUTINES IN SCHEMA mySchema TO generalUser +GRANT SELECT ON ALL TABLES IN SCHEMA mySchema TO auditUser; ++
As mentioned above, a USER or ROLE that does not own a schema can - be granted access to individual columns of a table in the schema. - HyperSQL adds a feature that is not part of the SQL Standard to allow - this access to be granted to a ROLE only for certain rows of a table, - based on a FILTER condition.
+ +A USER or ROLE that does not own a schema can be granted access to + individual columns of a table in the schema. HyperSQL adds a feature + that is not part of the SQL Standard to allow access to be granted to a + ROLE only for certain rows of a table, based on a FILTER + condition.
When the GRANT statement contains a FILTER condition, the
condition is applied to each row of the table that a SELECT, INSERT,
UPDATE, DELETE or MERGE statement tries to access. Only the rows that
@@ -407,7 +490,7 @@
A group of ordinary users with the eu_admin
role is
only allowed to access the data for a certain region. Another group with
the eu_user
role is only allowed to access the rows
- before the expiration date.
CREATE TABLE info(id INT PRIMARY KEY, info VARCHAR(100), region VARCHAR(32) NOT NULL, expires DATE NOT NULL) -- there is also a foreign key constraint on the REGION column to reference a list of valid region names. @@ -430,11 +513,11 @@ rows they cannot access.The
<filter clause>
can be used for other forms of fine-grained access control. In the example below, the - COMMON_USER role is defined and granted access during office hours + COMMON_ROLE role is defined and granted access during office hours only.-CREATE ROLE common_user -GRANT SELECT FILTER (WHERE EXTRACT(HOUR FROM CURRENT_TIMESTAMP) BETWEEN 9 AND 17) ON TABLE info TO common_user +CREATE ROLE common_role +GRANT SELECT FILTER (WHERE EXTRACT(HOUR FROM CURRENT_TIMESTAMP) BETWEEN 9 AND 17) ON TABLE info TO common_roleFine-grained data access control can also be used to implement @@ -467,7 +550,7 @@ assigned to other roles or to users. The same statements are also used in a different form to assign privileges on schema objects to users and roles.
- +CREATE USER @@ -486,7 +569,7 @@ characters and is case-sensitive. If
- +ADMIN
is specified, the DBA role is granted to the new user. Only a user with the DBA role can execute this statement.DROP USER
@@ -501,7 +584,7 @@ authorization for a schema, the schema is destroyed.Only a user with the DBA role can execute this statement.
- +ALTER USER ... SET PASSWORD @@ -520,7 +603,7 @@
<password>
is a string enclosed with single quote characters and is case-sensitive.Only a user with the DBA role can execute this command.
- +ALTER USER ... SET INITIAL SCHEMA @@ -542,7 +625,7 @@ session.
Only a user with the DBA role can execute this statement.
- +ALTER USER ... SET LOCAL @@ -563,7 +646,7 @@ authentication for a specific user.
Only a user with the DBA role can execute this statement.
- +SET PASSWORD @@ -578,7 +661,7 @@
Set the password for the current user.
- +<password>
is a string enclosed with single quote characters and is case-sensitive.SET INITIAL SCHEMA
@@ -596,7 +679,7 @@ for all users is used as the initial schema for the current user. The separate SET SCHEMA command allows the user to change the schema for the duration of the session. See also the Sessions and Transactions chapter. - +SET DATABASE DEFAULT INITIAL SCHEMA @@ -613,7 +696,7 @@
Sets the initial schema for new users. This schema can later be changed with the
- +<set initial schema statement>
command.CREATE ROLE
@@ -627,7 +710,7 @@Defines a new role. Initially the role has no rights, except those of the PUBLIC role. Only a user with the DBA role can execute this command.
- +DROP ROLE
@@ -641,7 +724,7 @@Drop (destroy) a role. If the specified role is the authorization for a schema, the schema is destroyed. Only a user with the DBA role can execute this statement.
- +GRANTED BY
@@ -660,7 +743,7 @@ clause can be used in various statements that perform GRANT or REVOKE actions. If the clause is not used, the authorization is CURRENT_USER. Otherwise, it is the specified authorization. - +GRANT
@@ -697,13 +780,21 @@ EXECUTE-
+<object name> ::= [ TABLE ] <table name> | - DOMAIN <domain name> | COLLATION <collation name> | CHARACTER - SET <character set name> | TRANSLATION <transliteration name> - | TYPE <user-defined type name> | SEQUENCE <sequence generator - name> | <specific routine designator> | ROUTINE <routine - name> | FUNCTION <function name> | PROCEDURE <procedure - name>
+<object name> ::= { <single object name> | + <schema object set name> }
++
+<simple object name> ::= [ TABLE ] <table + name> | DOMAIN <domain name> | COLLATION <collation name> | + CHARACTER SET <character set name> | TRANSLATION <transliteration + name> | TYPE <user-defined type name> | SEQUENCE <sequence + generator name> | <specific routine designator> | ROUTINE + <routine name> | FUNCTION <function name> | PROCEDURE + <procedure name>
++
<schema object set name> ::= ALL { TABLES | + SEQUENCES | ROUTINES } IN SCHEMA <schema name>
+ and any column that may be added to it in the future. +
<privilege column list> ::= <column name @@ -722,27 +813,33 @@ are discussed in the previous section. For a table or view, if
<privilege column list>
is not specified, then the privilege is granted on the table, which includes all of its columns - and any column that may be added to it in the future. For routines, the - name of the routine can be specified in two ways, either as the generic - name, or as the specific name for a signature. HyperSQL allows referencing - the generic name which covers all overloaded versions of a routine at the - same time. This is an extension to the SQL Standard which requires the use - of<specific routine designator>
to grant - privileges separately on each different signature of the - routine.For routines, the name of the routine can be specified in two + ways, either as the generic name, or as the specific name for a signature. + HyperSQL allows referencing the generic name which covers all overloaded + versions of a routine at the same time. This is an extension to the SQL + Standard, which requires the use of
+<specific routine + designator>
to grant privileges separately on each different + signature of the routine.HyperSQL also adds the
<schema object set + name>
option as an extension to the SQL Standard. This form + grants the privileges to all the tables of the schema with a single GRANT + statement.The
+ the granted privileges, or it can be used after individual + privileges.<filter clause>
can be specified after the<object name>
to limit access for all - the granted privileges, or it can be used after individual privileges. -Each
<grantee>
is the name of a role or a user. Examples of GRANT statement are given below:GRANT ALL ON SEQUENCE aSequence TO roleOrUser - GRANT SELECT ON aTable TO roleOrUser + GRANT SELECT ON aTable TO roleOrUser + GRANT SELECT(col3, col5) ON aTable TO aRole GRANT SELECT, UPDATE FILTER(WHERE aColumn > 2) ON aTABLE TO role1 -- filter only for update GRANT SELECT, UPDATE ON aTable FILTER(WHERE aColumn > 2) TO role2 -- filter for both select and update GRANT SELECT(columnA, columnB), UPDATE(columnA, columnB) ON TABLE aTable TO user1, role1, role2 GRANT EXECUTE ON SPECIFIC ROUTINE aroutine_1234 TO roleOrUser + GRANT SELECT ON ALL TABLES IN SCHEMA mySchema TO PUBLICAs mentioned in the general discussion, it is better to define a @@ -751,7 +848,7 @@ privileges of this role, they are automatically reflected in all the users that have the role. Fine-grained privileges (those with a FILTER clause) can be granted to roles only.
- +GRANT
@@ -780,7 +877,7 @@ GRANT EXECUTE ON ROUTINE aroutine TO approle
REVOKE privilege
@@ -793,8 +890,9 @@ <grantee> }... ] [ GRANTED BY <grantor> ] RESTRICT | CASCADE -Revoke privileges from a user or role.
- +Revoke privileges from a user or role. The syntax elements are + similar to the GRANT statements.
+REVOKE role
@@ -815,7 +913,7 @@$Revision: 6369 $
+$Revision: 6474 $