提交 c0354f2a authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 3c46ac75
...@@ -20,6 +20,8 @@ Build ...@@ -20,6 +20,8 @@ Build
Environment</a><br /> Environment</a><br />
<a href="#building"> <a href="#building">
Building the Software</a><br /> Building the Software</a><br />
<a href="#build_targets">
Build Targets</a><br />
<a href="#maven2"> <a href="#maven2">
Using Maven 2</a><br /> Using Maven 2</a><br />
<a href="#translating"> <a href="#translating">
...@@ -57,7 +59,7 @@ Newer version or compatible software works too. ...@@ -57,7 +59,7 @@ Newer version or compatible software works too.
<br /><a name="building"></a> <br /><a name="building"></a>
<h2>Building the Software</h2> <h2>Building the Software</h2>
<p> <p>
On the command line, go to the directory src and execute the following command: On the command line, go to the directory h2 and execute the following command:
</p> </p>
<pre> <pre>
build -? build -?
...@@ -68,16 +70,22 @@ You will get a list of targets. If you want to build the jar file, execute: ...@@ -68,16 +70,22 @@ You will get a list of targets. If you want to build the jar file, execute:
<pre> <pre>
build jar build jar
</pre> </pre>
<br /><a name="build_targets"></a>
<h2>Build Targets</h2>
<p>
The build system can generate smaller jar files as well. The following targets are currently supported:
</p>
<ul><li>jarClient: Create the h2client.jar. This only contains the remote JDBC implementation.
</li><li>jarSmall: Create the file h2small.jar. This only contains the embedded database. Debug information is disabled.
</li><li>jarJaqu: Create the file h2jaqu.jar. This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu.
</li></ul>
<p> <p>
To create a jar file with the JDBC API and the classes required to connect to a server only, To create the h2client.jar file, go to the directory h2 and execute the following command:
use the target jarClient:
</p> </p>
<pre> <pre>
build jarClient build jarClient
</pre> </pre>
<p>
The other targets may be used as well.
</p>
<br /><a name="maven2"></a> <br /><a name="maven2"></a>
<h2>Using Maven 2</h2> <h2>Using Maven 2</h2>
......
...@@ -408,7 +408,7 @@ or on the number of open connections. ...@@ -408,7 +408,7 @@ or on the number of open connections.
<h3>Remote Mode</h3> <h3>Remote Mode</h3>
<p> <p>
When using the remote mode (sometimes called client/server mode), an application opens a When using the remote mode (sometimes called server mode or client/server mode), an application opens a
database remotely using the JDBC or ODBC API. A server needs to be started within the same database remotely using the JDBC or ODBC API. A server needs to be started within the same
or another virtual machine (or on another computer). or another virtual machine (or on another computer).
Many applications can connect to the same database at the same time. Many applications can connect to the same database at the same time.
...@@ -426,7 +426,9 @@ or on the number of open connections. ...@@ -426,7 +426,9 @@ or on the number of open connections.
The mixed mode is a combination of the embedded and the remote mode. The mixed mode is a combination of the embedded and the remote mode.
The main application connects to a database in embedded mode, but also starts The main application connects to a database in embedded mode, but also starts
a server so that other applications (running in different virtual machines) can a server so that other applications (running in different virtual machines) can
concurrently access the same data. concurrently access the same data. The embedded connections are as fast as if
the database is used in just the embedded mode, while the remote
connections are a bit slower.
</p> </p>
<img src="images/connection-mode-mixed.png" <img src="images/connection-mode-mixed.png"
alt="The database and the server is running inside the application; another application connects remotely" /> alt="The database and the server is running inside the application; another application connects remotely" />
......
...@@ -169,6 +169,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches ...@@ -169,6 +169,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>ROW_NUMBER (not the same as ROWNUM) </li><li>ROW_NUMBER (not the same as ROWNUM)
</li><li>Partial indexing (see PostgreSQL) </li><li>Partial indexing (see PostgreSQL)
</li><li>The build should fail if the test fails </li><li>The build should fail if the test fails
</li><li>Add GUI to build a custom version (embedded, fulltext,...) using build flags
</li><li>http://rubyforge.org/projects/hypersonic/ </li><li>http://rubyforge.org/projects/hypersonic/
</li><li>DbVisualizer profile for H2 </li><li>DbVisualizer profile for H2
</li><li>Add comparator (x === y) : (x = y or (x is null and y is null)) </li><li>Add comparator (x === y) : (x = y or (x is null and y is null))
...@@ -226,7 +227,6 @@ Of course, patches are always welcome, but are not always applied as is. Patches ...@@ -226,7 +227,6 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>Dynamic length numbers / special methods for DataPage.writeByte / writeShort / Ronni Nielsen </li><li>Dynamic length numbers / special methods for DataPage.writeByte / writeShort / Ronni Nielsen
</li><li>Pluggable ThreadPool, (AvalonDB / deebee / Paul Hammant) </li><li>Pluggable ThreadPool, (AvalonDB / deebee / Paul Hammant)
</li><li>Recursive Queries (see details) </li><li>Recursive Queries (see details)
</li><li>Add GUI to build a custom version (embedded, fulltext,...)
</li><li>Release locks (shared or exclusive) on demand </li><li>Release locks (shared or exclusive) on demand
</li><li>Support OUTER UNION </li><li>Support OUTER UNION
</li><li>Support Parameterized Views (similar to CSVREAD, but using just SQL for the definition) </li><li>Support Parameterized Views (similar to CSVREAD, but using just SQL for the definition)
......
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
90136=Unsupported outer join condition\: {0} 90136=Unsupported outer join condition\: {0}
90137=Can only assign to a variable, not to\: {0} 90137=Can only assign to a variable, not to\: {0}
90138=Invalid database name\: {0} 90138=Invalid database name\: {0}
90139=The public static Java method was not found\: {0}
HY000=General error\: {0} HY000=General error\: {0}
HY004=Unknown data type\: {0} HY004=Unknown data type\: {0}
HYC00=Feature not supported HYC00=Feature not supported
......
...@@ -320,7 +320,15 @@ public abstract class Prepared { ...@@ -320,7 +320,15 @@ public abstract class Prepared {
Expression e = (Expression) parameters.get(i); Expression e = (Expression) parameters.get(i);
Value v = e.getValue(session); Value v = e.getValue(session);
try { try {
buff.append(v.getSQL()); // if (v.getPrecision() > SysProperties.MAX_TRACE_DATA_LENGTH) {
//
// }
String s = v.getSQL();
int test;
// if (s.length() > SysProperties.MAX_TRACE_DATA_LENGTH) {
// s = s.substring(0, SysProperties.MAX_TRACE_DATA_LENGTH) + " /* len: " + s.length() + " */";
// }
buff.append(s);
} catch (Exception t) { } catch (Exception t) {
buff.append("? /*"); buff.append("? /*");
buff.append(StringUtils.quoteJavaString(t.getMessage())); buff.append(StringUtils.quoteJavaString(t.getMessage()));
......
...@@ -1281,7 +1281,8 @@ public class ErrorCode { ...@@ -1281,7 +1281,8 @@ public class ErrorCode {
* the specified method was not found in the class. * the specified method was not found in the class.
* Example: * Example:
* <pre> * <pre>
* CREATE ALIAS TEST FOR "java.lang.Math.test"; * CREATE ALIAS TO_BINARY FOR "java.lang.Long.toBinaryString(long)";
* CALL TO_BINARY(10, 2);
* </pre> * </pre>
*/ */
public static final int METHOD_NOT_FOUND_1 = 90087; public static final int METHOD_NOT_FOUND_1 = 90087;
...@@ -1837,8 +1838,18 @@ public class ErrorCode { ...@@ -1837,8 +1838,18 @@ public class ErrorCode {
* </pre> * </pre>
*/ */
public static final int INVALID_DATABASE_NAME_1 = 90138; public static final int INVALID_DATABASE_NAME_1 = 90138;
/**
* The error with code <code>90139</code> is thrown when
* the specified public static Java method was not found in the class.
* Example:
* <pre>
* CREATE ALIAS TEST FOR "java.lang.Math.test";
* </pre>
*/
public static final int PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1 = 90139;
// next is 90139 // next is 90140
private ErrorCode() { private ErrorCode() {
// utility class // utility class
......
...@@ -84,7 +84,7 @@ public class FunctionAlias extends DbObjectBase { ...@@ -84,7 +84,7 @@ public class FunctionAlias extends DbObjectBase {
} }
} }
if (list.size() == 0) { if (list.size() == 0) {
throw Message.getSQLException(ErrorCode.METHOD_NOT_FOUND_1, methodName + " (" + className + ")"); throw Message.getSQLException(ErrorCode.PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1, methodName + " (" + className + ")");
} }
javaMethods = new JavaMethod[list.size()]; javaMethods = new JavaMethod[list.size()];
list.toArray(javaMethods); list.toArray(javaMethods);
...@@ -153,12 +153,13 @@ public class FunctionAlias extends DbObjectBase { ...@@ -153,12 +153,13 @@ public class FunctionAlias extends DbObjectBase {
*/ */
public JavaMethod findJavaMethod(Expression[] args) throws SQLException { public JavaMethod findJavaMethod(Expression[] args) throws SQLException {
load(); load();
int parameterCount = args.length;
for (int i = 0; i < javaMethods.length; i++) { for (int i = 0; i < javaMethods.length; i++) {
if (javaMethods[i].getParameterCount() == args.length) { if (javaMethods[i].getParameterCount() == parameterCount) {
return javaMethods[i]; return javaMethods[i];
} }
} }
throw Message.getSQLException(ErrorCode.METHOD_NOT_FOUND_1, methodName + " (" + className + ")"); throw Message.getSQLException(ErrorCode.METHOD_NOT_FOUND_1, methodName + " (" + className + ", parameter count: " + parameterCount + ")");
} }
public String getJavaClassName() { public String getJavaClassName() {
......
...@@ -185,12 +185,11 @@ public class SessionRemote implements SessionInterface, DataHandler { ...@@ -185,12 +185,11 @@ public class SessionRemote implements SessionInterface, DataHandler {
} }
} }
private String getTraceFilePrefix(String dbName) { private String getFilePrefix(String dir) {
String dir = SysProperties.CLIENT_TRACE_DIRECTORY;
StringBuffer buff = new StringBuffer(); StringBuffer buff = new StringBuffer();
buff.append(dir); buff.append(dir);
for (int i = 0; i < dbName.length(); i++) { for (int i = 0; i < databaseName.length(); i++) {
char ch = dbName.charAt(i); char ch = databaseName.charAt(i);
if (Character.isLetterOrDigit(ch)) { if (Character.isLetterOrDigit(ch)) {
buff.append(ch); buff.append(ch);
} else { } else {
...@@ -229,7 +228,7 @@ public class SessionRemote implements SessionInterface, DataHandler { ...@@ -229,7 +228,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
String traceLevelFile = ci.getProperty(SetTypes.TRACE_LEVEL_FILE, null); String traceLevelFile = ci.getProperty(SetTypes.TRACE_LEVEL_FILE, null);
if (traceLevelFile != null) { if (traceLevelFile != null) {
int level = Integer.parseInt(traceLevelFile); int level = Integer.parseInt(traceLevelFile);
String prefix = getTraceFilePrefix(databaseName); String prefix = getFilePrefix(SysProperties.CLIENT_TRACE_DIRECTORY);
String file = FileUtils.createTempFile(prefix, Constants.SUFFIX_TRACE_FILE, false, false); String file = FileUtils.createTempFile(prefix, Constants.SUFFIX_TRACE_FILE, false, false);
traceSystem.setFileName(file); traceSystem.setFileName(file);
traceSystem.setLevelFile(level); traceSystem.setLevelFile(level);
...@@ -454,7 +453,10 @@ public class SessionRemote implements SessionInterface, DataHandler { ...@@ -454,7 +453,10 @@ public class SessionRemote implements SessionInterface, DataHandler {
public String createTempFile() throws SQLException { public String createTempFile() throws SQLException {
try { try {
return FileUtils.createTempFile(databaseName, Constants.SUFFIX_TEMP_FILE, true, false); String prefix = getFilePrefix(System.getProperty("java.io.tmpdir"));
int test;
// return FileUtils.createTempFile(databaseName, Constants.SUFFIX_TEMP_FILE, true, false);
return FileUtils.createTempFile(prefix, Constants.SUFFIX_TEMP_FILE, true, false);
} catch (IOException e) { } catch (IOException e) {
throw Message.convertIOException(e, databaseName); throw Message.convertIOException(e, databaseName);
} }
......
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
90136=Diese Outer Join Bedingung wird nicht unterst\u00FCtzt\: {0} 90136=Diese Outer Join Bedingung wird nicht unterst\u00FCtzt\: {0}
90137=Werte k\u00F6nnen nur einer Variablen zugewiesen werden, nicht an\: {0} 90137=Werte k\u00F6nnen nur einer Variablen zugewiesen werden, nicht an\: {0}
90138=Ung\u00FCltiger Datenbank Name\: {0} 90138=Ung\u00FCltiger Datenbank Name\: {0}
90139=Die (public static) Java Funktion wurde nicht gefunden\: {0}
HY000=Allgemeiner Fehler\: {0} HY000=Allgemeiner Fehler\: {0}
HY004=Unbekannter Datentyp\: {0} HY004=Unbekannter Datentyp\: {0}
HYC00=Dieses Feature wird unterst\u00FCtzt HYC00=Dieses Feature wird unterst\u00FCtzt
......
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
90136=Unsupported outer join condition\: {0} 90136=Unsupported outer join condition\: {0}
90137=Can only assign to a variable, not to\: {0} 90137=Can only assign to a variable, not to\: {0}
90138=Invalid database name\: {0} 90138=Invalid database name\: {0}
90139=The public static Java method was not found\: {0}
HY000=General error\: {0} HY000=General error\: {0}
HY004=Unknown data type\: {0} HY004=Unknown data type\: {0}
HYC00=Feature not supported HYC00=Feature not supported
......
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
90136=\u672A\u30B5\u30DD\u30FC\u30C8\u306E\u5916\u90E8\u7D50\u5408\u6761\u4EF6\: {0} 90136=\u672A\u30B5\u30DD\u30FC\u30C8\u306E\u5916\u90E8\u7D50\u5408\u6761\u4EF6\: {0}
90137=\u5272\u308A\u5F53\u3066\u306F\u5909\u6570\u306B\u306E\u307F\u53EF\u80FD\u3067\u3059\u3002{0} \u306B\u306F\u3067\u304D\u307E\u305B\u3093 90137=\u5272\u308A\u5F53\u3066\u306F\u5909\u6570\u306B\u306E\u307F\u53EF\u80FD\u3067\u3059\u3002{0} \u306B\u306F\u3067\u304D\u307E\u305B\u3093
90138=\#Invalid database name\: {0} 90138=\#Invalid database name\: {0}
90139=\#The public static Java method was not found\: {0}
HY000=\u4E00\u822C\u30A8\u30E9\u30FC\: {0} HY000=\u4E00\u822C\u30A8\u30E9\u30FC\: {0}
HY004=\u4E0D\u660E\u306A\u30C7\u30FC\u30BF\u578B\: {0} HY004=\u4E0D\u660E\u306A\u30C7\u30FC\u30BF\u578B\: {0}
HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093 HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
......
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
90136=\#Unsupported outer join condition\: {0} 90136=\#Unsupported outer join condition\: {0}
90137=\#Can only assign to a variable, not to\: {0} 90137=\#Can only assign to a variable, not to\: {0}
90138=\#Invalid database name\: {0} 90138=\#Invalid database name\: {0}
90139=\#The public static Java method was not found\: {0}
HY000=Blad ogolny\: {0} HY000=Blad ogolny\: {0}
HY004=Nieznany typ danyche\: {0} HY004=Nieznany typ danyche\: {0}
HYC00=Cecha nie jest wspierana HYC00=Cecha nie jest wspierana
......
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
90136=\#Unsupported outer join condition\: {0} 90136=\#Unsupported outer join condition\: {0}
90137=\#Can only assign to a variable, not to\: {0} 90137=\#Can only assign to a variable, not to\: {0}
90138=\#Invalid database name\: {0} 90138=\#Invalid database name\: {0}
90139=\#The public static Java method was not found\: {0}
HY000=Erro geral\: {0} HY000=Erro geral\: {0}
HY004=Tipo de dados desconhecido\: {0} HY004=Tipo de dados desconhecido\: {0}
HYC00=Recurso n\u00E3o suportado HYC00=Recurso n\u00E3o suportado
......
...@@ -358,7 +358,8 @@ CREATE AGGREGATE MEDIAN FOR ""com.acme.db.Median"" ...@@ -358,7 +358,8 @@ CREATE AGGREGATE MEDIAN FOR ""com.acme.db.Median""
CREATE ALIAS [IF NOT EXISTS] newFunctionAliasName FOR classAndMethodName CREATE ALIAS [IF NOT EXISTS] newFunctionAliasName FOR classAndMethodName
"," ","
Creates a new function alias. The method name must be the full qualified class and method name, Creates a new function alias. The method name must be the full qualified class and method name,
and may optionally include the parameter classes as in ""java.lang.Integer.parseInt(java.lang.String, int)"") and may optionally include the parameter classes as in ""java.lang.Integer.parseInt(java.lang.String, int)"").
The class and the method must both be public, and the method must be static.
Admin rights are required to execute this command. Admin rights are required to execute this command.
If the first parameter of the Java function is a java.sql.Connection, then If the first parameter of the Java function is a java.sql.Connection, then
the current to the database is provided. This connection must not be closed. the current to the database is provided. This connection must not be closed.
......
...@@ -150,7 +150,7 @@ public class TcpServer implements Service { ...@@ -150,7 +150,7 @@ public class TcpServer implements Service {
public void init(String[] args) { public void init(String[] args) {
port = DEFAULT_PORT; port = DEFAULT_PORT;
for (int i = 0; i < args.length; i++) { for (int i = 0; args != null && i < args.length; i++) {
String a = args[i]; String a = args[i];
if ("-trace".equals(a)) { if ("-trace".equals(a)) {
trace = true; trace = true;
......
...@@ -49,7 +49,7 @@ public class PgServer implements Service { ...@@ -49,7 +49,7 @@ public class PgServer implements Service {
public void init(String[] args) { public void init(String[] args) {
port = DEFAULT_PORT; port = DEFAULT_PORT;
for (int i = 0; i < args.length; i++) { for (int i = 0; args != null && i < args.length; i++) {
String a = args[i]; String a = args[i];
if ("-trace".equals(a)) { if ("-trace".equals(a)) {
trace = true; trace = true;
......
...@@ -654,6 +654,7 @@ public class ValueLob extends Value { ...@@ -654,6 +654,7 @@ public class ValueLob extends Value {
} }
public String toString() { public String toString() {
int tst;
if (small == null) { if (small == null) {
return getClass().getName() + " file: " + fileName + " type: " + type + " precision: " + precision; return getClass().getName() + " file: " + fileName + " type: " + type + " precision: " + precision;
} }
......
...@@ -238,6 +238,7 @@ public class Build extends BuildBase { ...@@ -238,6 +238,7 @@ public class Build extends BuildBase {
/** /**
* Create the file h2small.jar. This only contains the embedded database. * Create the file h2small.jar. This only contains the embedded database.
* Debug information is disabled.
*/ */
public void jarSmall() { public void jarSmall() {
compile(false, false); compile(false, false);
...@@ -259,7 +260,7 @@ public class Build extends BuildBase { ...@@ -259,7 +260,7 @@ public class Build extends BuildBase {
/** /**
* Create the file h2jaqu.jar. This only contains the JaQu (Java Query) * Create the file h2jaqu.jar. This only contains the JaQu (Java Query)
* implementation. * implementation. All other jar files do not include JaQu.
*/ */
public void jarJaqu() { public void jarJaqu() {
compile(true, false); compile(true, false);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论