提交 4fe8ae0d authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 bd598e58
#Sat Jun 16 21:45:09 CEST 2007 #Tue Jul 24 08:17:27 CEST 2007
javac=javac javac=javac
benchmark.drivers.dir=D\:/data/java benchmark.drivers.dir=D\:/data/java
version.name.maven=1.0.20070712
path.servlet.jar=C\:/data/classpath/servlet-api.jar path.servlet.jar=C\:/data/classpath/servlet-api.jar
version.name.maven=1.0.20070712
jdk=1.4 jdk=1.4
...@@ -15,11 +15,8 @@ ...@@ -15,11 +15,8 @@
<delete includeemptydirs="true" verbose="true"> <delete includeemptydirs="true" verbose="true">
<fileset dir="bin" includes="**/*.txt"/> <fileset dir="bin" includes="**/*.txt"/>
<fileset dir="bin" includes="h2-test.exe"/> <fileset dir="bin" includes="h2-test.exe"/>
<fileset dir="bin" includes="systray4j.jar"/>
<fileset dir="bin" includes="org/**/*"/> <fileset dir="bin" includes="org/**/*"/>
<fileset dir="bin" includes="org"/> <fileset dir="bin" includes="org"/>
<fileset dir="bin" includes="snoozesoft/**/*"/>
<fileset dir="bin" includes="snoozesoft"/>
<fileset dir="bin" includes="META-INF/**/*"/> <fileset dir="bin" includes="META-INF/**/*"/>
<fileset dir="bin" includes="META-INF"/> <fileset dir="bin" includes="META-INF"/>
<fileset dir="docs/html" includes="onePage.html"/> <fileset dir="docs/html" includes="onePage.html"/>
...@@ -113,12 +110,9 @@ ...@@ -113,12 +110,9 @@
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true"> <javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true">
<exclude name="org/h2/server/web/*.*"/> <exclude name="org/h2/server/web/*.*"/>
</javac> </javac>
<unzip src="src/systray/systray4j.jar" dest="bin"/>
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/systray" destdir="bin" debug="true"/>
<copy todir="bin" overwrite="true"> <copy todir="bin" overwrite="true">
<fileset dir="src/main" includes="META-INF/**/*"/> <fileset dir="src/main" includes="META-INF/**/*"/>
<fileset dir="src/main" includes="**/*.png"/> <fileset dir="src/main" includes="**/*.png"/>
<fileset dir="src/systray" includes="**/*.ico"/>
<fileset dir="src/installer" includes="*.bat"/> <fileset dir="src/installer" includes="*.bat"/>
<fileset dir="src/test" includes="**/*.txt"/> <fileset dir="src/test" includes="**/*.txt"/>
<fileset dir="src/test" includes="**/*.properties"/> <fileset dir="src/test" includes="**/*.properties"/>
...@@ -175,7 +169,6 @@ ...@@ -175,7 +169,6 @@
<exclude name="**/*.bat"/> <exclude name="**/*.bat"/>
<exclude name="**/*.txt"/> <exclude name="**/*.txt"/>
</jar> </jar>
<copy todir="bin" file="src/systray/systray4j.dll"/>
</target> </target>
<target name="jarClient" depends="compileResources"> <target name="jarClient" depends="compileResources">
......
...@@ -18,8 +18,6 @@ Features ...@@ -18,8 +18,6 @@ Features
Comparison to Other Database Engines</a><br /> Comparison to Other Database Engines</a><br />
<a href="#products_work_with"> <a href="#products_work_with">
Products that Work with H2</a><br /> Products that Work with H2</a><br />
<a href="#why_java">
Why Java</a><br />
<a href="#connection_modes"> <a href="#connection_modes">
Connection Modes</a><br /> Connection Modes</a><br />
<a href="#database_url"> <a href="#database_url">
...@@ -66,6 +64,8 @@ Features ...@@ -66,6 +64,8 @@ Features
Compacting a Database</a><br /> Compacting a Database</a><br />
<a href="#cache_settings"> <a href="#cache_settings">
Cache Settings</a><br /> Cache Settings</a><br />
<a href="#why_java">
Why Java</a><br />
<br /><a name="feature_list"></a> <br /><a name="feature_list"></a>
<h2>Feature List</h2> <h2>Feature List</h2>
...@@ -307,40 +307,6 @@ It looks like the development of this database has stopped. The last release was ...@@ -307,40 +307,6 @@ It looks like the development of this database has stopped. The last release was
</tr> </tr>
</table> </table>
<br /><a name="why_java"></a>
<h2>Why Java</h2>
A few reasons using a Java database are:
<ul>
<li>Very simple to integrate in Java applications
</li><li>Support for many different platforms
</li><li>More secure than native applications (no buffer overflows)
</li><li>User defined functions (or triggers) run very fast
</li><li>Unicode support
</li></ul>
<p>
Some people think that Java is still too slow for low level operations,
but this is not the case (not any more). In general, the code can be written a lot faster
than using C or C++. Like that, it is possible to concentrate on improving the algorithms
(that make the application faster) rather than porting the code and dealing with low
level stuff (such as memory management or dealing with threads).
Garbage collection is now probably faster than manual memory management.
</p><p>
A lot of features are already built in (for example Unicode, network libraries).
It is very easy to write secure code because buffer overflows and such
problems can be detected very easily. Some features such as the reflection
mechanism can be used for randomized testing.
</p><p>
Java is also future proof: A lot of companies support Java, and the
open source support for Java is getting better as well (see GCJ).
</p><p>
This software does not rely on many Java libraries or other software, to
increase the portability and ease of use, and for performance reasons. For example,
the encryption algorithms and many library functions are implemented in the database
instead of using the existing libraries. Libraries that are not available in open source
Java implementations (such as Swing) are not used or only used for specific features
(such as the SysTray library).
</p>
<br /><a name="connection_modes"></a> <br /><a name="connection_modes"></a>
<h2>Connection Modes</h2> <h2>Connection Modes</h2>
The following connection modes are supported: The following connection modes are supported:
...@@ -1292,4 +1258,37 @@ call SELECT * FROM INFORMATION_SCHEMA.SETTINGS. The number of pages read / writt ...@@ -1292,4 +1258,37 @@ call SELECT * FROM INFORMATION_SCHEMA.SETTINGS. The number of pages read / writt
is listed for the data and index file. is listed for the data and index file.
</p> </p>
<br /><a name="why_java"></a>
<h2>Why Java</h2>
A few reasons using a Java database are:
<ul>
<li>Very simple to integrate in Java applications
</li><li>Support for many different platforms
</li><li>More secure than native applications (no buffer overflows)
</li><li>User defined functions (or triggers) run very fast
</li><li>Unicode support
</li></ul>
<p>
Some people think that Java is still too slow for low level operations,
but this is not the case (not any more). In general, the code can be written a lot faster
than using C or C++. Like that, it is possible to concentrate on improving the algorithms
(that make the application faster) rather than porting the code and dealing with low
level stuff (such as memory management or dealing with threads).
Garbage collection is now probably faster than manual memory management.
</p><p>
A lot of features are already built in (for example Unicode, network libraries).
It is very easy to write secure code because buffer overflows and such
problems can be detected very easily. Some features such as the reflection
mechanism can be used for randomized testing.
</p><p>
Java is also future proof: A lot of companies support Java,
and it is now open source.
</p><p>
This software does not rely on many Java libraries or other software, to
increase the portability and ease of use, and for performance reasons. For example,
the encryption algorithms and many library functions are implemented in the database
instead of using the existing libraries. Libraries that are not available in open source
Java implementations (such as Swing) are not used or only used for specific features.
</p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
...@@ -37,7 +37,16 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -37,7 +37,16 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3> <h3>Version 1.0 (Current)</h3>
<h3>Version 1.0 / 2007-TODO</h3><ul> <h3>Version 1.0 / 2007-TODO</h3><ul>
<li>Calculation of cache memory usage has been improved. <li>The old view implementation has been removed.
</li><li>The SysTray tool has been removed, because JDK 1.6 has native support for system tray icons.
Use the Console tool (org.h2.tools.Console) automatically installs a system tray icon if JDK 1.6 is used.
</li><li>H2 Console: In the last release, the shutdown button did not work. Fixed.
</li><li>Referential integrity can now be disabled using
SET REFERENTIAL_INTEGRITY FALSE. It can also be disable only
for one table using ALTER TABLE SET REFERENTIAL_INTEGRITY FALSE.
</li><li>The Backup and Restore tools, and the BACKUP command did not back up LOBs when
h2.lobFilesInDirectories was enabled. Fixed.
</li><li>Calculation of cache memory usage has been improved.
</li><li>In some situations record were released too late from the cache. Fixed. </li><li>In some situations record were released too late from the cache. Fixed.
</li><li>The cache size is now measured in KB instead of blocks of 128 byte. </li><li>The cache size is now measured in KB instead of blocks of 128 byte.
</li><li>CREATE TABLE ... AS SELECT now needs less memory. While inserting the rows, the undo </li><li>CREATE TABLE ... AS SELECT now needs less memory. While inserting the rows, the undo
...@@ -796,11 +805,14 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -796,11 +805,14 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Stop the server: close all open databases first </li><li>Stop the server: close all open databases first
</li><li>SET variable { TO | = } { value | 'value' | DEFAULT } </li><li>SET variable { TO | = } { value | 'value' | DEFAULT }
</li><li>Running totals: select @running:=if(@previous=t.ID,@running,0)+t.NUM as TOTAL, @previous:=t.ID </li><li>Running totals: select @running:=if(@previous=t.ID,@running,0)+t.NUM as TOTAL, @previous:=t.ID
</li><li>Option to globally disable / enable referential integrity checks
</li><li>Support SET REFERENTIAL_INTEGRITY {TRUE|FALSE} </li><li>Support SET REFERENTIAL_INTEGRITY {TRUE|FALSE}
</li><li>Better support large transactions, large updates / deletes: use less memory </li><li>Better support large transactions, large updates / deletes: use less memory
</li><li>Better support large transactions, large updates / deletes: allow tables without primary key </li><li>Better support large transactions, large updates / deletes: allow tables without primary key
</li><li>Support Oracle RPAD and LPAD(string, n[, pad]) (truncate the end if longer) </li><li>Support Oracle RPAD and LPAD(string, n[, pad]) (truncate the end if longer)
</li><li>Allow editing NULL values in the Console </li><li>Allow editing NULL values in the Console
</li><li>Updatable result sets: DatabaseMetaData.ownUpdatesAreVisible = true.
Simple solution: automatically calls 'refresh' when the result was changed.
</li></ul> </li></ul>
<h3>Priority 2</h3> <h3>Priority 2</h3>
...@@ -836,7 +848,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -836,7 +848,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Performance / server mode: use UDP optionally? </li><li>Performance / server mode: use UDP optionally?
</li><li>Version check: docs / web console (using javascript), and maybe in the library (using TCP/IP) </li><li>Version check: docs / web console (using javascript), and maybe in the library (using TCP/IP)
</li><li>Aggregates: support MEDIAN </li><li>Aggregates: support MEDIAN
</li><li>Option to globally disable / enable referential integrity checks
</li><li>Web server classloader: override findResource / getResourceFrom </li><li>Web server classloader: override findResource / getResourceFrom
</li><li>Cost for embedded temporary view is calculated wrong, if result is constant </li><li>Cost for embedded temporary view is calculated wrong, if result is constant
</li><li>Comparison: pluggable sort order: natural sort </li><li>Comparison: pluggable sort order: natural sort
...@@ -879,7 +890,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -879,7 +890,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Allow custom settings (@PATH for RUNSCRIPT for example) </li><li>Allow custom settings (@PATH for RUNSCRIPT for example)
</li><li>Performance test: read the data (getString) and use column names to get the data </li><li>Performance test: read the data (getString) and use column names to get the data
</li><li>EXE file: maybe use http://jsmooth.sourceforge.net </li><li>EXE file: maybe use http://jsmooth.sourceforge.net
</li><li>System Tray: http://jroller.com/page/stritti?entry=system_tray_implementations_for_java
</li><li>SELECT ... FOR READ WAIT [maxMillisToWait] </li><li>SELECT ... FOR READ WAIT [maxMillisToWait]
</li><li>Automatically delete the index file if opening it fails </li><li>Automatically delete the index file if opening it fails
</li><li>Performance: Automatically build in-memory indexes if the whole table is in memory </li><li>Performance: Automatically build in-memory indexes if the whole table is in memory
...@@ -1053,13 +1063,12 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -1053,13 +1063,12 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Support native XML data type </li><li>Support native XML data type
</li><li>Support triggers with a string property or option: SpringTrigger, OSGITrigger </li><li>Support triggers with a string property or option: SpringTrigger, OSGITrigger
</li><li>Clustering: adding a node should be very fast and without interrupting clients (very short lock) </li><li>Clustering: adding a node should be very fast and without interrupting clients (very short lock)
</li><li>Updatable result sets: DatabaseMetaData.ownUpdatesAreVisible = true
</li><li>Cache size should be in KB
</li><li>Support materialized views (using triggers) </li><li>Support materialized views (using triggers)
</li><li>Store dates in local timezone (portability of database files) </li><li>Store dates in local timezone (portability of database files)
</li><li>Ability to resize the cache array when resizing the cache </li><li>Ability to resize the cache array when resizing the cache
</li><li>Automatic conversion from WHERE X>10 AND X>20 to X>20 </li><li>Automatic conversion from WHERE X>10 AND X>20 to X>20
</li><li>Time based cache writing (one second after writing the log) </li><li>Time based cache writing (one second after writing the log)
</li><li>Write a H2 driver for http://db.apache.org/ddlutils/
</li></ul> </li></ul>
<h3>Not Planned</h3> <h3>Not Planned</h3>
......
...@@ -9,7 +9,7 @@ Message: ...@@ -9,7 +9,7 @@ Message:
$text $text
"; ";
$headers = 'From: newsletter@h2database.com' . "\r\n" . $headers = 'From: newsletter@h2database.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();S 'X-Mailer: PHP/' . phpversion();
mail("dbsupport@h2database.com", "[H2 Newsletter] $now", $body, $headers); mail("dbsupport@h2database.com", "[H2 Newsletter] $now", $body, $headers);
?> ?>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title> <html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
......
...@@ -253,6 +253,15 @@ public class Set extends Prepared { ...@@ -253,6 +253,15 @@ public class Set extends Prepared {
session.setUndoLogEnabled(value == 1); session.setUndoLogEnabled(value == 1);
break; break;
} }
case SetTypes.REFERENTIAL_INTEGRITY: {
session.getUser().checkAdmin();
int value = getIntValue();
if(value < 0 || value > 1) {
throw Message.getInvalidValueException(""+getIntValue(), "REFERENTIAL_INTEGRITY");
}
database.setReferentialIntegrity(value == 1);
break;
}
default: default:
throw Message.getInternalError("type="+type); throw Message.getInternalError("type="+type);
} }
......
...@@ -17,6 +17,7 @@ public class SetTypes { ...@@ -17,6 +17,7 @@ public class SetTypes {
public static final int LOG = 19, THROTTLE = 20, MAX_MEMORY_UNDO = 21, MAX_LENGTH_INPLACE_LOB = 22; public static final int LOG = 19, THROTTLE = 20, MAX_MEMORY_UNDO = 21, MAX_LENGTH_INPLACE_LOB = 22;
public static final int COMPRESS_LOB = 23, ALLOW_LITERALS = 24, MULTI_THREADED = 25, SCHEMA = 26; public static final int COMPRESS_LOB = 23, ALLOW_LITERALS = 24, MULTI_THREADED = 25, SCHEMA = 26;
public static final int OPTIMIZE_REUSE_RESULTS = 27, SCHEMA_SEARCH_PATH = 28, UNDO_LOG = 29; public static final int OPTIMIZE_REUSE_RESULTS = 27, SCHEMA_SEARCH_PATH = 28, UNDO_LOG = 29;
public static final int REFERENTIAL_INTEGRITY = 30;
private static ObjectArray types = new ObjectArray(); private static ObjectArray types = new ObjectArray();
static { static {
...@@ -49,6 +50,7 @@ public class SetTypes { ...@@ -49,6 +50,7 @@ public class SetTypes {
setType(OPTIMIZE_REUSE_RESULTS, "OPTIMIZE_REUSE_RESULTS"); setType(OPTIMIZE_REUSE_RESULTS, "OPTIMIZE_REUSE_RESULTS");
setType(SCHEMA_SEARCH_PATH, "SCHEMA_SEARCH_PATH"); setType(SCHEMA_SEARCH_PATH, "SCHEMA_SEARCH_PATH");
setType(UNDO_LOG, "UNDO_LOG"); setType(UNDO_LOG, "UNDO_LOG");
setType(REFERENTIAL_INTEGRITY, "REFERENTIAL_INTEGRITY");
} }
private static void setType(int type, String name) { private static void setType(int type, String name) {
......
...@@ -219,6 +219,9 @@ public class ConstraintReferential extends Constraint { ...@@ -219,6 +219,9 @@ public class ConstraintReferential extends Constraint {
} }
public void checkRow(Session session, Table t, Row oldRow, Row newRow) throws SQLException { public void checkRow(Session session, Table t, Row oldRow, Row newRow) throws SQLException {
if(!database.getReferentialIntegrity()) {
return;
}
if(!table.getCheckForeignKeyConstraints() || !refTable.getCheckForeignKeyConstraints()) { if(!table.getCheckForeignKeyConstraints() || !refTable.getCheckForeignKeyConstraints()) {
return; return;
} }
......
...@@ -216,6 +216,7 @@ public class Constants { ...@@ -216,6 +216,7 @@ public class Constants {
// TODO: also remove DataHandler.allocateObjectId, createTempFile when setting this to true and removing it // TODO: also remove DataHandler.allocateObjectId, createTempFile when setting this to true and removing it
public static final boolean LOB_FILES_IN_DIRECTORIES = getBooleanSetting("h2.lobFilesInDirectories", false); public static final boolean LOB_FILES_IN_DIRECTORIES = getBooleanSetting("h2.lobFilesInDirectories", false);
public static final int LOB_FILES_PER_DIRECTORY = getIntSetting("h2.lobFilesPerDirectory", 256); public static final int LOB_FILES_PER_DIRECTORY = getIntSetting("h2.lobFilesPerDirectory", 256);
public static final boolean CHECK = getBooleanSetting("h2.check", true); public static final boolean CHECK = getBooleanSetting("h2.check", true);
...@@ -241,7 +242,6 @@ public class Constants { ...@@ -241,7 +242,6 @@ public class Constants {
public static final String CLIENT_TRACE_DIRECTORY = getStringSetting("h2.clientTraceDirectory", "trace.db/"); public static final String CLIENT_TRACE_DIRECTORY = getStringSetting("h2.clientTraceDirectory", "trace.db/");
public static int MAX_FILE_RETRY = Math.max(1, getIntSetting("h2.maxFileRetry", 16)); public static int MAX_FILE_RETRY = Math.max(1, getIntSetting("h2.maxFileRetry", 16));
public static boolean LOB_CLOSE_BETWEEN_READS = getBooleanSetting("h2.lobCloseBetweenReads", false); public static boolean LOB_CLOSE_BETWEEN_READS = getBooleanSetting("h2.lobCloseBetweenReads", false);
public static boolean INDEX_OLD = getBooleanSetting("h2.indexOld", false);
public static final boolean ALLOW_BIG_DECIMAL_EXTENSIONS = getBooleanSetting("h2.allowBigDecimalExtensions", false); public static final boolean ALLOW_BIG_DECIMAL_EXTENSIONS = getBooleanSetting("h2.allowBigDecimalExtensions", false);
public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", true); public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", true);
public static final boolean TRACE_IO = getBooleanSetting("h2.traceIO", false); public static final boolean TRACE_IO = getBooleanSetting("h2.traceIO", false);
......
...@@ -137,6 +137,7 @@ public class Database implements DataHandler { ...@@ -137,6 +137,7 @@ public class Database implements DataHandler {
private String cacheType; private String cacheType;
private boolean indexSummaryValid = true; private boolean indexSummaryValid = true;
private String accessModeLog, accessModeData; private String accessModeLog, accessModeData;
private boolean referentialIntegrity = true;
public Database(String name, ConnectionInfo ci, String cipher) throws SQLException { public Database(String name, ConnectionInfo ci, String cipher) throws SQLException {
this.compareMode = new CompareMode(null, null); this.compareMode = new CompareMode(null, null);
...@@ -1503,4 +1504,12 @@ public class Database implements DataHandler { ...@@ -1503,4 +1504,12 @@ public class Database implements DataHandler {
return sessions.size(); return sessions.size();
} }
public void setReferentialIntegrity(boolean b) {
referentialIntegrity = b;
}
public boolean getReferentialIntegrity() {
return referentialIntegrity;
}
} }
...@@ -146,6 +146,7 @@ Adds a new column to a table. ...@@ -146,6 +146,7 @@ Adds a new column to a table.
"," ","
ALTER TABLE TEST ADD CREATEDATE TIMESTAMP ALTER TABLE TEST ADD CREATEDATE TIMESTAMP
" "
"Commands (DDL)","ALTER TABLE ADD CONSTRAINT"," "Commands (DDL)","ALTER TABLE ADD CONSTRAINT","
ALTER TABLE tableName ADD constraint ALTER TABLE tableName ADD constraint
"," ","
...@@ -241,6 +242,16 @@ Removes a constraint or a primary key from a table. ...@@ -241,6 +242,16 @@ Removes a constraint or a primary key from a table.
ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME
" "
"Commands (DDL)","ALTER TABLE SET","
ALTER TABLE tableName SET REFERENTIAL_INTEGRITY [TRUE|FALSE]
","
Disables or enables referential integrity checking for a table.
Enabling it does not check existing data.
Use SET REFERENTIAL_INTEGRITY to disable it for all tables.
","
ALTER TABLE TEST SET REFERENTIAL_INTEGRITY FALSE
"
"Commands (DDL)","ALTER TABLE RENAME"," "Commands (DDL)","ALTER TABLE RENAME","
ALTER TABLE tableName RENAME TO newName ALTER TABLE tableName RENAME TO newName
"," ","
...@@ -953,6 +964,18 @@ The password must be in single quotes. It is case sensitive and can contain spac ...@@ -953,6 +964,18 @@ The password must be in single quotes. It is case sensitive and can contain spac
SET PASSWORD 'abcstzri!.5' SET PASSWORD 'abcstzri!.5'
" "
"Commands (Other)","SET REFERENTIAL_INTEGRITY","
SET REFERENTIAL_INTEGRITY [TRUE|FALSE]
","
Disabled or enables referential integrity checking for the whole database.
Enabling it does not check existing data.
Use ALTER TABLE SET to disable it only for one table.
This setting is not persistent.
Admin rights are required to execute this command.
","
SET REFERENTIAL_INTEGRITY FALSE
"
"Commands (Other)","SET SALT HASH"," "Commands (Other)","SET SALT HASH","
SET SALT bytes HASH bytes SET SALT bytes HASH bytes
"," ","
......
...@@ -364,6 +364,7 @@ public class PgServerThread implements Runnable { ...@@ -364,6 +364,7 @@ public class PgServerThread implements Runnable {
s = "set DATESTYLE ISO"; s = "set DATESTYLE ISO";
} }
int todoNeedToSupportInParser; int todoNeedToSupportInParser;
s = StringUtils.replaceAll(s, "::oid", "");
s = StringUtils.replaceAll(s, "i.indkey[ia.attnum-1]", "0"); s = StringUtils.replaceAll(s, "i.indkey[ia.attnum-1]", "0");
println(s + ";"); println(s + ";");
return s; return s;
......
...@@ -8,6 +8,15 @@ create schema pg_catalog; ...@@ -8,6 +8,15 @@ create schema pg_catalog;
set search_path = PUBLIC, pg_catalog; set search_path = PUBLIC, pg_catalog;
create table pg_catalog.pg_roles -- (oid, rolname, rolcreaterole, rolcreatedb)
as
select
id oid,
cast(name as varchar_ignorecase) rolname,
case when admin then 't' else 'f' end as rolcreaterole,
case when admin then 't' else 'f' end as rolcreatedb
from information_schema.users;
create table pg_catalog.pg_namespace -- (oid, nspname) create table pg_catalog.pg_namespace -- (oid, nspname)
as as
select select
......
...@@ -87,7 +87,7 @@ public class WebServer implements Service { ...@@ -87,7 +87,7 @@ public class WebServer implements Service {
private String startDateTime; private String startDateTime;
private ServerSocket serverSocket; private ServerSocket serverSocket;
private String url; private String url;
private boolean allowShutdown; private boolean allowShutdown = true;
private Thread listenerThread; private Thread listenerThread;
byte[] getFile(String file) throws IOException { byte[] getFile(String file) throws IOException {
......
...@@ -5,15 +5,12 @@ ...@@ -5,15 +5,12 @@
package org.h2.table; package org.h2.table;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.command.Prepared; import org.h2.command.Prepared;
import org.h2.command.dml.Query; import org.h2.command.dml.Query;
import org.h2.engine.Constants;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.expression.Expression; import org.h2.expression.Expression;
import org.h2.index.Index; import org.h2.index.Index;
import org.h2.index.IndexType; import org.h2.index.IndexType;
import org.h2.index.ViewIndexOld;
import org.h2.index.ViewIndex; import org.h2.index.ViewIndex;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.result.Row; import org.h2.result.Row;
...@@ -28,8 +25,7 @@ public class TableView extends Table { ...@@ -28,8 +25,7 @@ public class TableView extends Table {
private ObjectArray tables; private ObjectArray tables;
private final String[] columnNames; private final String[] columnNames;
private Query viewQuery; private Query viewQuery;
private ViewIndexOld indexOld; private ViewIndex index;
private ViewIndex indexNew;
private boolean recursive; private boolean recursive;
private SQLException createException; private SQLException createException;
...@@ -38,12 +34,7 @@ public class TableView extends Table { ...@@ -38,12 +34,7 @@ public class TableView extends Table {
this.querySQL = querySQL; this.querySQL = querySQL;
this.columnNames = columnNames; this.columnNames = columnNames;
this.recursive = recursive; this.recursive = recursive;
int todoRemoveIndexOld; index = new ViewIndex(this, querySQL, params, recursive);
if(Constants.INDEX_OLD) {
indexOld = new ViewIndexOld(this, querySQL, params, recursive);
} else {
indexNew = new ViewIndex(this, querySQL, params, recursive);
}
initColumnsAndTables(session); initColumnsAndTables(session);
} }
...@@ -88,18 +79,12 @@ public class TableView extends Table { ...@@ -88,18 +79,12 @@ public class TableView extends Table {
// this avoids problems when creating the view when opening the database // this avoids problems when creating the view when opening the database
tables = new ObjectArray(); tables = new ObjectArray();
cols = new Column[0]; cols = new Column[0];
int needToTestRecursiveQueries;
if(recursive && columnNames != null) { if(recursive && columnNames != null) {
cols = new Column[columnNames.length]; cols = new Column[columnNames.length];
for(int i=0; i<columnNames.length; i++) { for(int i=0; i<columnNames.length; i++) {
cols[i] = new Column(columnNames[i], Value.STRING, 255, 0); cols[i] = new Column(columnNames[i], Value.STRING, 255, 0);
} }
if(Constants.INDEX_OLD) { index.setRecursive(true);
indexOld.setRecursive(true);
} else {
indexNew.setRecursive(true);
}
recursive = true; recursive = true;
createException = null; createException = null;
} }
...@@ -114,14 +99,8 @@ public class TableView extends Table { ...@@ -114,14 +99,8 @@ public class TableView extends Table {
public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException { public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException {
PlanItem item = new PlanItem(); PlanItem item = new PlanItem();
Index i2; item.cost = index.getCost(session, masks);
if(Constants.INDEX_OLD) { Index i2 = new ViewIndex(this, index, session, masks);
item.cost = indexOld.getCost(session, masks);
i2 = new ViewIndexOld(this, indexOld, session, masks);
} else {
item.cost = indexNew.getCost(session, masks);
i2 = new ViewIndex(this, indexNew, session, masks);
}
item.setIndex(i2); item.setIndex(i2);
return item; return item;
} }
...@@ -216,8 +195,7 @@ public class TableView extends Table { ...@@ -216,8 +195,7 @@ public class TableView extends Table {
removeViewFromTables(); removeViewFromTables();
super.removeChildrenAndResources(session); super.removeChildrenAndResources(session);
querySQL = null; querySQL = null;
indexNew = null; index = null;
indexOld = null;
invalidate(); invalidate();
} }
......
...@@ -137,6 +137,12 @@ public class Restore { ...@@ -137,6 +137,12 @@ public class Restore {
break; break;
} }
String fileName = entry.getName(); String fileName = entry.getName();
// restoring windows backups on linux and vice versa
fileName = fileName.replace('\\', File.separatorChar);
fileName = fileName.replace('/', File.separatorChar);
if(fileName.startsWith(File.separator)) {
fileName = fileName.substring(1);
}
boolean copy = false; boolean copy = false;
if(db == null) { if(db == null) {
copy = true; copy = true;
......
...@@ -5,6 +5,7 @@ public class ObjectUtils { ...@@ -5,6 +5,7 @@ public class ObjectUtils {
public static Integer getInteger(int x) { public static Integer getInteger(int x) {
//#ifdef JDK16 //#ifdef JDK16
/* /*
if(true)
return Integer.valueOf(x); return Integer.valueOf(x);
*/ */
//#endif //#endif
...@@ -13,9 +14,22 @@ public class ObjectUtils { ...@@ -13,9 +14,22 @@ public class ObjectUtils {
//#endif //#endif
} }
public static Character getCharacter(char x) {
//#ifdef JDK16
/*
if(true)
return Character.valueOf(x);
*/
//#endif
//#ifdef JDK14
return new Character(x);
//#endif
}
public static Long getLong(long x) { public static Long getLong(long x) {
//#ifdef JDK16 //#ifdef JDK16
/* /*
if(true)
return Long.valueOf(x); return Long.valueOf(x);
*/ */
//#endif //#endif
...@@ -27,6 +41,7 @@ public class ObjectUtils { ...@@ -27,6 +41,7 @@ public class ObjectUtils {
public static Short getShort(short x) { public static Short getShort(short x) {
//#ifdef JDK16 //#ifdef JDK16
/* /*
if(true)
return Short.valueOf(x); return Short.valueOf(x);
*/ */
//#endif //#endif
...@@ -38,6 +53,7 @@ public class ObjectUtils { ...@@ -38,6 +53,7 @@ public class ObjectUtils {
public static Byte getByte(byte x) { public static Byte getByte(byte x) {
//#ifdef JDK16 //#ifdef JDK16
/* /*
if(true)
return Byte.valueOf(x); return Byte.valueOf(x);
*/ */
//#endif //#endif
...@@ -49,6 +65,7 @@ public class ObjectUtils { ...@@ -49,6 +65,7 @@ public class ObjectUtils {
public static Float getFloat(float x) { public static Float getFloat(float x) {
//#ifdef JDK16 //#ifdef JDK16
/* /*
if(true)
return Float.valueOf(x); return Float.valueOf(x);
*/ */
//#endif //#endif
...@@ -60,6 +77,7 @@ public class ObjectUtils { ...@@ -60,6 +77,7 @@ public class ObjectUtils {
public static Double getDouble(double x) { public static Double getDouble(double x) {
//#ifdef JDK16 //#ifdef JDK16
/* /*
if(true)
return Double.valueOf(x); return Double.valueOf(x);
*/ */
//#endif //#endif
......
...@@ -703,19 +703,19 @@ public class DataType { ...@@ -703,19 +703,19 @@ public class DataType {
if(clazz == Boolean.TYPE) { if(clazz == Boolean.TYPE) {
return Boolean.FALSE; return Boolean.FALSE;
} else if(clazz == Byte.TYPE) { } else if(clazz == Byte.TYPE) {
return new Byte((byte)0); return ObjectUtils.getByte((byte)0);
} else if(clazz == Character.TYPE) { } else if(clazz == Character.TYPE) {
return new Character((char)0); return ObjectUtils.getCharacter((char)0);
} else if(clazz == Short.TYPE) { } else if(clazz == Short.TYPE) {
return new Short((short)0); return ObjectUtils.getShort((short)0);
} else if(clazz == Integer.TYPE) { } else if(clazz == Integer.TYPE) {
return ObjectUtils.getInteger(0); return ObjectUtils.getInteger(0);
} else if(clazz == Long.TYPE) { } else if(clazz == Long.TYPE) {
return ObjectUtils.getLong(0); return ObjectUtils.getLong(0);
} else if(clazz == Float.TYPE) { } else if(clazz == Float.TYPE) {
return new Float(0); return ObjectUtils.getFloat(0);
} else if(clazz == Double.TYPE) { } else if(clazz == Double.TYPE) {
return new Double(0); return ObjectUtils.getDouble(0);
} else { } else {
throw Message.getInternalError("primitive="+ clazz.toString()); throw Message.getInternalError("primitive="+ clazz.toString());
} }
......
...@@ -8,6 +8,7 @@ import java.sql.PreparedStatement; ...@@ -8,6 +8,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.util.ObjectUtils;
/** /**
* @author Thomas * @author Thomas
...@@ -96,7 +97,7 @@ public class ValueDouble extends Value { ...@@ -96,7 +97,7 @@ public class ValueDouble extends Value {
} }
public Object getObject() { public Object getObject() {
return new Double(value); return ObjectUtils.getDouble(value);
} }
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { public void set(PreparedStatement prep, int parameterIndex) throws SQLException {
......
...@@ -8,6 +8,7 @@ import java.sql.PreparedStatement; ...@@ -8,6 +8,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.util.ObjectUtils;
/** /**
* @author Thomas * @author Thomas
...@@ -96,7 +97,7 @@ public class ValueFloat extends Value { ...@@ -96,7 +97,7 @@ public class ValueFloat extends Value {
} }
public Object getObject() { public Object getObject() {
return new Float(value); return ObjectUtils.getFloat(value);
} }
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { public void set(PreparedStatement prep, int parameterIndex) throws SQLException {
......
...@@ -9,6 +9,7 @@ import java.sql.SQLException; ...@@ -9,6 +9,7 @@ import java.sql.SQLException;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.util.ObjectUtils;
public class ValueShort extends Value { public class ValueShort extends Value {
public static final int PRECISION = 5; public static final int PRECISION = 5;
...@@ -103,7 +104,7 @@ public class ValueShort extends Value { ...@@ -103,7 +104,7 @@ public class ValueShort extends Value {
} }
public Object getObject() { public Object getObject() {
return new Short(value); return ObjectUtils.getShort(value);
} }
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { public void set(PreparedStatement prep, int parameterIndex) throws SQLException {
......
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2;
import java.sql.SQLException;
import org.h2.message.Message;
import org.h2.tools.Server;
import org.h2.util.StartBrowser;
import snoozesoft.systray4j.SysTrayMenu;
import snoozesoft.systray4j.SysTrayMenuEvent;
import snoozesoft.systray4j.SysTrayMenuIcon;
import snoozesoft.systray4j.SysTrayMenuItem;
import snoozesoft.systray4j.SysTrayMenuListener;
public class SysTray implements SysTrayMenuListener {
Server tcp;
Server web;
Server odbc;
public static void main(String[] args) throws Exception {
new SysTray().run(args);
}
private void startBrowser() {
if(web != null) {
StartBrowser.openURL(web.getURL());
}
}
private void run(String[] args) {
try {
web = Server.createWebServer(args);
web.start();
tcp = Server.createTcpServer(args).start();
odbc = Server.createOdbcServer(args).start();
createMenu();
} catch(SQLException e) {
if(e.getErrorCode() == Message.EXCEPTION_OPENING_PORT_1) {
System.out.println("Port is in use, maybe another server server already running on " + web.getURL());
} else {
e.printStackTrace();
}
}
// start browser anyway (even if the server is already running)
// because some people don't look at the output,
// but are wondering why nothing happens
StartBrowser.openURL(web.getURL());
if(!web.isRunning()) {
System.exit(1);
}
}
public void menuItemSelected(SysTrayMenuEvent e) {
if (e.getActionCommand().equals("exit")) {
System.exit(0);
} else if (e.getActionCommand().equals("open")) {
startBrowser();
}
}
public void iconLeftClicked(SysTrayMenuEvent e) {
startBrowser();
}
public void iconLeftDoubleClicked(SysTrayMenuEvent e) {
startBrowser();
}
void createMenu() {
SysTrayMenuItem itemExit = new SysTrayMenuItem("Exit", "exit");
itemExit.addSysTrayMenuListener(this);
SysTrayMenuItem itemOpen = new SysTrayMenuItem("H2 Console", "open");
itemOpen.addSysTrayMenuListener(this);
SysTrayMenuIcon icon;
icon = new SysTrayMenuIcon(getClass().getResource("/org/h2/h2.ico"));
SysTrayMenu menu = new SysTrayMenu(icon, "H2 Console");
icon.addSysTrayMenuListener(this);
menu.addItem(itemExit);
menu.addSeparator();
menu.addItem(itemOpen);
}
}
...@@ -94,35 +94,18 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -94,35 +94,18 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/* /*
Restore doesn't work with subdirectories SELECT db.oid, datname, spcname, datallowconn, datconfig, datacl, pg_encoding_to_char(encoding) AS serverencoding,
pg_get_userbyid(datdba) AS datowner,has_database_privilege(db.oid, 'CREATE') as cancreate
FROM pg_database db
LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
ORDER BY datname;
SELECT description FROM pg_description WHERE objoid=0;
Backup and BackupCommand with subdirectories (lobs): stored in a flat directory structure
-Dh2.lobFilesInDirectories=true
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME CLOB);
@LOOP 20 INSERT INTO TEST VALUES(?, SPACE(10000));
BACKUP TO 'backup.zip';
test Backup tool as well!
PMD rename Performance > Comparison [/Compatibility]
move Comparison to Other Database Engines > Comparison
replace new Byte, Double, Float, Long, Byte, Short with ObjectUtils.get move Products that Work with H2 > Comparison
move Performance Tuning > Advanced Topics
http://fastutil.dsi.unimi.it/
http://javolution.org/
http://joda-time.sourceforge.net/
http://ibatis.apache.org/
SET REFERENTIAL_INTEGRITY TRUE
replace new Byte, Double, Float, Long, Byte, Short with ObjectUtils.get
http://fastutil.dsi.unimi.it/
http://javolution.org/
http://joda-time.sourceforge.net/
http://ibatis.apache.org/
SET REFERENTIAL_INTEGRITY TRUE
set read-committed as the default set read-committed as the default
...@@ -148,7 +131,6 @@ The unique object identifier of a row. PostgreSQL automatically adds this 4-byte ...@@ -148,7 +131,6 @@ The unique object identifier of a row. PostgreSQL automatically adds this 4-byte
ctid (tuple identifier) ctid (tuple identifier)
The identifier which describes the physical location of the tuple within the database. A pair of numbers are represented by the ctid: the block number, and tuple index within that block. The identifier which describes the physical location of the tuple within the database. A pair of numbers are represented by the ctid: the block number, and tuple index within that block.
make sure INDEX_LOOKUP_NEW = is true by default.
Test Console (batch, javaw, different platforms) Test Console (batch, javaw, different platforms)
test with openoffice (metadata changes) test with openoffice (metadata changes)
...@@ -159,8 +141,6 @@ java org.h2.test.TestAll halt ...@@ -159,8 +141,6 @@ java org.h2.test.TestAll halt
timer test timer test
backup.sql / lob file problem
Mail http://sf.net/projects/samooha Mail http://sf.net/projects/samooha
java.lang.Exception: query was too quick; result: 0 time:968 java.lang.Exception: query was too quick; result: 0 time:968
...@@ -170,11 +150,11 @@ java.lang.Exception: query was too quick; result: 0 time:968 ...@@ -170,11 +150,11 @@ java.lang.Exception: query was too quick; result: 0 time:968
h2\src\docsrc\html\images\SQLInjection.txt h2\src\docsrc\html\images\SQLInjection.txt
D:\pictures\2007-email
ftp server: problem with multithreading? ftp server: problem with multithreading?
send http://thecodist.com/fiche/thecodist/article/sql-injections-how-not-to-get-stuck to JavaWorld, TheServerSide, send http://thecodist.com/fiche/thecodist/article/sql-injections-how-not-to-get-stuck to JavaWorld, TheServerSide,
Send SQL Injection solution proposal to PostgreSQL, MySQL, Derby, HSQLDB,...
Convert SQL-injection-2.txt to html document, include SQLInjection.java sample
MySQL, PostgreSQL MySQL, PostgreSQL
http://semmle.com/ http://semmle.com/
...@@ -184,25 +164,14 @@ READ_TEXT(fileName String) returning a CLOB. ...@@ -184,25 +164,14 @@ READ_TEXT(fileName String) returning a CLOB.
I am not sure if this will read the CLOB in memory however. I am not sure if this will read the CLOB in memory however.
I will add this to the todo list. I will add this to the todo list.
Docs: Fix Quickstart
Send SQL Injection solution proposal to PostgreSQL, MySQL, Derby, HSQLDB,...
Improve LOB in directories performance Improve LOB in directories performance
Improve documentation for MAX_LENGTH_INPLACE_LOB Improve documentation for MAX_LENGTH_INPLACE_LOB
Convert SQL-injection-2.txt to html document, include SQLInjection.java sample
Test Eclipse DTP 1.5 (HSQLDB / H2 connection bug fixed) Test Eclipse DTP 1.5 (HSQLDB / H2 connection bug fixed)
Automate real power off tests Automate real power off tests
how to make -baseDir work for H2 Console (embedded mode)?
-Dh2.baseDir=x {$baseDir}/...
http://db.apache.org/ddlutils/ (write a H2 driver)
Negative dictionary: Negative dictionary:
Please note that Please note that
...@@ -213,8 +182,6 @@ make static member variables final (this helps find forgotten initializers) ...@@ -213,8 +182,6 @@ make static member variables final (this helps find forgotten initializers)
Merge more from diff.zip (Pavel Ganelin) Merge more from diff.zip (Pavel Ganelin)
Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip
performance: try to shorten methods that are used very often
store dates as 'local'. Problem: existing files use GMT (use escape syntax) store dates as 'local'. Problem: existing files use GMT (use escape syntax)
drop table test; drop table test;
CREATE TABLE TEST( ID BIGINT PRIMARY KEY, CREATED TIMESTAMP); CREATE TABLE TEST( ID BIGINT PRIMARY KEY, CREATED TIMESTAMP);
...@@ -223,6 +190,13 @@ SELECT * FROM TEST; ...@@ -223,6 +190,13 @@ SELECT * FROM TEST;
Server: use one listener (detect if the request comes from an ODBC or TCP client). Server: use one listener (detect if the request comes from an ODBC or TCP client).
PMD
http://fastutil.dsi.unimi.it/
http://javolution.org/
http://joda-time.sourceforge.net/
http://ibatis.apache.org/
*/ */
/* /*
......
...@@ -7,6 +7,7 @@ package org.h2.test.db; ...@@ -7,6 +7,7 @@ package org.h2.test.db;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Statement; import java.sql.Statement;
import org.h2.engine.Constants;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.Restore; import org.h2.tools.Restore;
......
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(parent int primary key, child int, foreign key(child) references (parent));
> ok
insert into test values(1, 1);
> update count: 1
insert into test values(2, 3);
> exception
set autocommit false;
> ok
set referential_integrity false;
> ok
insert into test values(4, 4);
> update count: 1
insert into test values(5, 6);
> update count: 1
set referential_integrity true;
> ok
insert into test values(7, 7), (8, 9);
> exception
set autocommit true;
> ok
drop table test;
> ok
create table test as select 1, space(10) from dual where 1=0 union all select x, cast(space(100) as varchar(101)) d from system_range(1, 100); create table test as select 1, space(10) from dual where 1=0 union all select x, cast(space(100) as varchar(101)) d from system_range(1, 100);
> ok > ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论