提交 9cf66529 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 433bf879
......@@ -11,7 +11,7 @@ Advanced Topics
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<h1>Advanced Topics</h1>
<a href="#resultsets">
<a href="#result_sets">
Result Sets</a><br>
<a href="#large_objects">
Large Objects</a><br>
......@@ -46,7 +46,7 @@ Advanced Topics
<a href="#glossary_links">
Glossary and Links</a><br>
<br><a name="resultsets"></a>
<br><a name="result_sets"></a>
<h2>Result Sets</h2>
<h3>Limiting the Number of Rows</h3>
......@@ -85,7 +85,7 @@ CREATE LINKED TABLE LINK('org.postgresql.Driver', 'jdbc:postgresql:test', 'sa',
</pre>
It is then possible to access the table in the usual way.
There is a restriction when inserting data to this table: When inserting or updating rows into the table,
NULL values and values that are not set in the insert statement are both inserted as NULL.
NULL and values that are not set in the insert statement are both inserted as NULL.
This may not have the desired effect if a default value in the target table is other than NULL.
<br><a name="transaction_isolation"></a>
......@@ -358,7 +358,7 @@ In Java, there are two ways how this can be achieved:
</p>
<ul>
<li>FileDescriptor.sync(). The documentation says that this will force all system buffers to synchronize with the underlying device.
Sync is supposed to return after all in-memory modified copies of buffers associated with this FileDesecriptor
Sync is supposed to return after all in-memory modified copies of buffers associated with this FileDescriptor
have been written to the physical medium.
<li>FileChannel.force() (since JDK 1.4). This method is supposed to force any updates to this channel's file
to be written to the storage device that contains it.
......@@ -643,7 +643,7 @@ custom certificates are supported as well.
<br><a name="uuid"></a>
<h2>Universally Unique Identifiers (UUID)</h2>
This database supports UUIDs. Also upported is a function to create new UUIDs using
This database supports the UUIDs. Also supported is a function to create new UUIDs using
a cryptographically strong pseudo random number generator.
With random UUIDs, the chance of two having the same value can be calculated
using the probability theory. See also 'Birthday Paradox'.
......
......@@ -14,10 +14,8 @@ Frequently Asked Questions
<h3>Are there any known bugs? When is the next release?</h3>
Usually, bugs get fixes as they are found. There is a release every few weeks.
The next release is planned for
2007-01-29.
Here is the list of known and confirmed issues as of
2007-01-17:
2007-01-30:
<ul>
<li>Can not build using ant with JDK 1.3 at the moment. However most things are fixed.
<li>Some problems have been found with right outer join. Internally, it is converted to left outer join, which
......@@ -43,7 +41,7 @@ some problems that have not yet been found.
Areas that are not completely tested:
<ul>
<li>Platforms other than Windows XP and the Sun JVM 1.4
<li>Data types BLOBs / CLOBs, VARCHAR_IGNORECASE, OTHER
<li>Data types BLOB, CLOB, VARCHAR_IGNORECASE, OTHER
<li>Cluster mode, 2-Phase Commit, Savepoints
<li>Server mode (well tested, but not as well as Embedded mode)
<li>Multi-Threading and using multiple connections
......
......@@ -349,7 +349,7 @@ This is achieved using different database URLs. The settings in the URLs are not
<td>In-Memory (named)</td>
<td>
jdbc:h2:mem:&lt;databaseName&gt;<br>
jdbc:h2:mem:imdb1
jdbc:h2:mem:test_mem
</td>
</tr>
<tr>
......@@ -816,14 +816,14 @@ Here is the list of currently supported modes and the difference to the regular
<tr><td>
PostgreSQL
</td><td>
Concatenation of a NULL value with another value results in NULL.
Concatenation of a NULL with another value results in NULL.
Usually, the NULL is treated as an empty string if only one of the operators is NULL,
and NULL is only returned if both values are NULL.
</td></tr>
<tr><td>
MySQL
</td><td>
When inserting data, if a column is defined to be NOT NULL and a null value is inserted,
When inserting data, if a column is defined to be NOT NULL and NULL is inserted,
then a 0 (or empty string, or the current timestamp for timestamp columns) value is used.
Usually, this operation is not allowed and an exception is thrown.
</td></tr>
......@@ -1024,7 +1024,7 @@ secure. A way to create good passwords that can be remembered is, take the first
letters of a sentence, use upper and lower case characters, and creatively include special characters.
Example:
</p><p>
i'sE2rTpiUKtt (it's easy to remember this password if you know the trick)
i'sE2rtPiUKtT (it's easy to remember this password if you know the trick)
</p>
<h3>Passwords: Using Char Arrays instead of Strings</h3>
......@@ -1096,7 +1096,7 @@ public class Function {
</pre>
The Java function must be registered in the database by calling CREATE ALIAS:
<pre>
CREATE ALIAS ISPRIME FOR "org.h2.samples.Function.isPrime"
CREATE ALIAS IS_PRIME FOR "org.h2.samples.Function.isPrime"
</pre>
For a complete sample application, see src/test/org/h2/samples/Function.java.
......
......@@ -137,7 +137,7 @@ Welcome to H2, the free SQL database. The main feature of H2 are:
server/web/res/_text_*.properties). Or click on the PayPal button below to<br>
donate money. You will be listed as a supporter:
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Zahlen Sie mit PayPal - schnell, kostenlos und sicher!">
<img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1">
......
......@@ -62,31 +62,6 @@ In most cases H2 is a lot faster than all other
<tr><td>Statement per Second</td><td>#</td><td>9761</td><td>4546</td><td>1975</td><td>5259</td><td>7823</td></tr>
</table>
<h3>PolePosition Benchmark</h3>
<table border="1" class="bar">
<tr><th>Test Case</th><th>Unit</th><th>H2</th><th>HSQLDB</th><th>MySQL</th></tr>
<tr><td>Melbourne write</td><td>ms</td><td>369</td><td>249</td><td>2022</td></tr>
<tr><td>Melbourne read</td><td>ms</td><td>47</td><td>49</td><td>93</td></tr>
<tr><td>Melbourne read_hot</td><td>ms</td><td>24</td><td>43</td><td>95</td></tr>
<tr><td>Melbourne delete</td><td>ms</td><td>147</td><td>133</td><td>176</td></tr>
<tr><td>Sepang write</td><td>ms</td><td>965</td><td>1201</td><td>3213</td></tr>
<tr><td>Sepang read</td><td>ms</td><td>765</td><td>948</td><td>3455</td></tr>
<tr><td>Sepang read_hot</td><td>ms</td><td>789</td><td>859</td><td>3563</td></tr>
<tr><td>Sepang delete</td><td>ms</td><td>1384</td><td>1596</td><td>6214</td></tr>
<tr><td>Bahrain write</td><td>ms</td><td>1186</td><td>1387</td><td>6904</td></tr>
<tr><td>Bahrain query_indexed_string</td><td>ms</td><td>336</td><td>170</td><td>693</td></tr>
<tr><td>Bahrain query_string</td><td>ms</td><td>18064</td><td>39703</td><td>41243</td></tr>
<tr><td>Bahrain query_indexed_int</td><td>ms</td><td>104</td><td>134</td><td>678</td></tr>
<tr><td>Bahrain update</td><td>ms</td><td>191</td><td>87</td><td>159</td></tr>
<tr><td>Bahrain delete</td><td>ms</td><td>1215</td><td>729</td><td>6812</td></tr>
<tr><td>Imola retrieve</td><td>ms</td><td>198</td><td>194</td><td>4036</td></tr>
<tr><td>Barcelona write</td><td>ms</td><td>413</td><td>832</td><td>3191</td></tr>
<tr><td>Barcelona read</td><td>ms</td><td>119</td><td>160</td><td>1177</td></tr>
<tr><td>Barcelona query</td><td>ms</td><td>20</td><td>5169</td><td>101</td></tr>
<tr><td>Barcelona delete</td><td>ms</td><td>388</td><td>319</td><td>3287</td></tr>
<tr><td>Total</td><td>ms</td><td>26724</td><td>53962</td><td>87112</td></tr>
</table>
<h3>Benchmark Results and Comments</h3>
<h4>H2</h4>
......@@ -218,6 +193,35 @@ and for each step a new connection is opened and then closed.
That means the Open/Close time listed is for opening a connection
if the database is already in use.
<h3>PolePosition Benchmark</h3>
<p>
The PolePosition is an open source benchmark. The algorithms are all quite simple.
It was developed / sponsored by db4o.
</p>
<table border="1" class="bar">
<tr><th>Test Case</th><th>Unit</th><th>H2</th><th>HSQLDB</th><th>MySQL</th></tr>
<tr><td>Melbourne write</td><td>ms</td><td>369</td><td>249</td><td>2022</td></tr>
<tr><td>Melbourne read</td><td>ms</td><td>47</td><td>49</td><td>93</td></tr>
<tr><td>Melbourne read_hot</td><td>ms</td><td>24</td><td>43</td><td>95</td></tr>
<tr><td>Melbourne delete</td><td>ms</td><td>147</td><td>133</td><td>176</td></tr>
<tr><td>Sepang write</td><td>ms</td><td>965</td><td>1201</td><td>3213</td></tr>
<tr><td>Sepang read</td><td>ms</td><td>765</td><td>948</td><td>3455</td></tr>
<tr><td>Sepang read_hot</td><td>ms</td><td>789</td><td>859</td><td>3563</td></tr>
<tr><td>Sepang delete</td><td>ms</td><td>1384</td><td>1596</td><td>6214</td></tr>
<tr><td>Bahrain write</td><td>ms</td><td>1186</td><td>1387</td><td>6904</td></tr>
<tr><td>Bahrain query_indexed_string</td><td>ms</td><td>336</td><td>170</td><td>693</td></tr>
<tr><td>Bahrain query_string</td><td>ms</td><td>18064</td><td>39703</td><td>41243</td></tr>
<tr><td>Bahrain query_indexed_int</td><td>ms</td><td>104</td><td>134</td><td>678</td></tr>
<tr><td>Bahrain update</td><td>ms</td><td>191</td><td>87</td><td>159</td></tr>
<tr><td>Bahrain delete</td><td>ms</td><td>1215</td><td>729</td><td>6812</td></tr>
<tr><td>Imola retrieve</td><td>ms</td><td>198</td><td>194</td><td>4036</td></tr>
<tr><td>Barcelona write</td><td>ms</td><td>413</td><td>832</td><td>3191</td></tr>
<tr><td>Barcelona read</td><td>ms</td><td>119</td><td>160</td><td>1177</td></tr>
<tr><td>Barcelona query</td><td>ms</td><td>20</td><td>5169</td><td>101</td></tr>
<tr><td>Barcelona delete</td><td>ms</td><td>388</td><td>319</td><td>3287</td></tr>
<tr><td>Total</td><td>ms</td><td>26724</td><td>53962</td><td>87112</td></tr>
</table>
<br><a name="application_profiling"></a>
<h2>Application Profiling</h2>
......
......@@ -62,21 +62,21 @@ function listWords(value, open) {
word = wordRef.split("=")[0];
var tr = table.insertRow(x++);
var td = document.createElement('td');
var tdc = document.createAttribute('class');
tdc.nodeValue = 'searchKeyword';
td.setAttributeNode(tdc);
var tdClass = document.createAttribute('class');
tdClass.nodeValue = 'searchKeyword';
td.setAttributeNode(tdClass);
var ah = document.createElement('a');
var hre = document.createAttribute('href');
hre.nodeValue = 'javascript:set("' + word + '");';
var href = document.createAttribute('href');
href.nodeValue = 'javascript:set("' + word + '");';
var link = document.createTextNode(word);
ah.setAttributeNode(hre);
ah.setAttributeNode(href);
ah.appendChild(link);
td.appendChild(ah);
tr.appendChild(td);
pis = wordRef.split("=")[1].split(",");
piList = wordRef.split("=")[1].split(",");
if(count<20 || open==word) {
x = addReferences(x, pis, word);
x = addReferences(x, piList, word);
}
}
}
......@@ -129,10 +129,10 @@ function listAnd(keywords) {
for(var j=0; j<words.length; j++) {
var wordRef = words[j];
if(wordRef.toLowerCase().indexOf(value)==0) {
pis = wordRef.split("=")[1].split(",");
piList = wordRef.split("=")[1].split(",");
var w=1;
for(var k=0; k<pis.length; k++) {
var pi = pis[k];
for(var k=0; k<piList.length; k++) {
var pi = piList[k];
if(pi.charAt(0) == 't') {
pi = pi.substring(1);
w=10000;
......@@ -155,36 +155,36 @@ function listAnd(keywords) {
}
var x = 0;
var table = document.getElementById('result');
var pis = new Array();
var piw = new Array();
var piList = new Array();
var piWeight = new Array();
for(var i=0; i<pages.length; i++) {
if(count[i] >= keywords.length) {
pis[x] = '' + i;
piw[x] = weight[i];
piList[x] = '' + i;
piWeight[x] = weight[i];
x++;
}
}
// sort
for (var i = 1, j; i < x; i++) {
var tw = piw[i];
var ti = pis[i];
for (j = i - 1; j >= 0 && (piw[j] < tw); j--) {
piw[j + 1] = piw[j];
pis[j + 1] = pis[j];
var tw = piWeight[i];
var ti = piList[i];
for (j = i - 1; j >= 0 && (piWeight[j] < tw); j--) {
piWeight[j + 1] = piWeight[j];
piList[j + 1] = piList[j];
}
piw[j + 1] = tw;
pis[j + 1] = ti;
piWeight[j + 1] = tw;
piList[j + 1] = ti;
}
addReferences(0, pis, keywords);
if(pis.length == 0) {
addReferences(0, piList, keywords);
if(piList.length == 0) {
noResults(table);
}
}
function addReferences(x, pis, word) {
function addReferences(x, piList, word) {
var table = document.getElementById('result');
for(var j=0; j<pis.length; j++) {
var pi = pis[j];
for(var j=0; j<piList.length; j++) {
var pi = piList[j];
if(pi.charAt(0) == 't') {
pi = pi.substring(1);
} else if(pi.charAt(0) == 'h') {
......@@ -194,18 +194,18 @@ function addReferences(x, pis, word) {
}
var tr = table.insertRow(x++);
var td = document.createElement('td');
var tdc = document.createAttribute('class');
tdc.nodeValue = 'searchLink';
td.setAttributeNode(tdc);
var tdClass = document.createAttribute('class');
tdClass.nodeValue = 'searchLink';
td.setAttributeNode(tdClass);
var ah = document.createElement('a');
var hre = document.createAttribute('href');
var href = document.createAttribute('href');
var thisLink = 'javascript:go(' + pi + ', "' + word + '")';
if(firstLink==null) {
firstLink = pi;
firstLinkWord = word;
}
hre.nodeValue = thisLink;
ah.setAttributeNode(hre);
href.nodeValue = thisLink;
ah.setAttributeNode(href);
var page = pages[pi];
var link = document.createTextNode(page.title);
ah.appendChild(link);
......@@ -240,9 +240,9 @@ function replaceOtherChars(s) {
function noResults(table) {
var tr = table.insertRow(0);
var td = document.createElement('td');
var tdc = document.createAttribute('class');
tdc.nodeValue = 'searchKeyword';
td.setAttributeNode(tdc);
var tdClass = document.createAttribute('class');
tdClass.nodeValue = 'searchKeyword';
td.setAttributeNode(tdClass);
var text = document.createTextNode('No results found');
td.appendChild(text);
tr.appendChild(td);
......
......@@ -27,7 +27,7 @@ Tutorial
CSV (Comma Separated Values) Support</a><br>
<a href="#upgrade_backup_restore">
Upgrade, Backup, and Restore</a><br>
<a href="#openoffice">
<a href="#open_office">
Using OpenOffice Base</a><br>
<br><a name="tutorial_starting_h2_console"></a>
......@@ -384,8 +384,8 @@ SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("NAME", Types.VARCHAR, 255, 0);
rs.addColumn("EMAIL", Types.VARCHAR, 255, 0);
rs.addColumn("PHONE", Types.VARCHAR, 255, 0);
rs.addRow(new String[]{"Bob Meier", "bob.meier@abcde.fgh", "+41123456789"});
rs.addRow(new String[]{"John Jones", "johnjones@abcde.fgh", "+41976543210"});
rs.addRow(new String[]{"Bob Meier", "bob.meier@abcde.abc", "+41123456789"});
rs.addRow(new String[]{"John Jones", "john.jones@abcde.abc", "+41976543210"});
Csv.write("test.csv", rs, null);
</pre>
......@@ -438,7 +438,7 @@ SQL script files may contain references to other script files, in the form of
RUNSCRIPT commands. However, when using the server mode, the references script files
need to be available on the server side.
<br><a name="openoffice"></a>
<br><a name="open_office"></a>
<h2>Using OpenOffice Base</h2>
OpenOffice.org Base supports database access over the JDBC API. To connect to a H2 database
using OpenOffice Base, you first need to add the JDBC driver to OpenOffice.
......
......@@ -1705,7 +1705,9 @@ public class Parser {
Sequence sequence = database.getSchema(schemaName).findSequence(objectName);
if(sequence != null) {
Function function = Function.getFunction(database, "CURRVAL");
function.setParameter(0, ValueExpression.get(ValueString.get(objectName)));
function.setParameter(0, ValueExpression.get(ValueString.get(schemaName)));
function.setParameter(1, ValueExpression.get(ValueString.get(objectName)));
function.doneWithParameters();
return function;
}
}
......@@ -1931,6 +1933,7 @@ public class Parser {
function.setParameter(0, when);
function.setParameter(1, then);
function.setParameter(2, elsePart);
function.doneWithParameters();
return function;
}
......@@ -3587,12 +3590,12 @@ public class Parser {
command.setStartWith(start);
return command;
} else if(readIf("SELECTIVITY")) {
int sel = getPositiveInt();
int selectivity = getPositiveInt();
AlterTableAlterColumn command = new AlterTableAlterColumn(session, tableSchema);
command.setTable(table);
command.setType(AlterTableAlterColumn.SELECTIVITY);
command.setOldColumn(column);
command.setStartWith(sel);
command.setStartWith(selectivity);
return command;
} else {
Column newColumn = parseColumnForTable(columnName);
......
/*
* 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.command.dml;
import java.io.FileInputStream;
......@@ -50,38 +54,32 @@ public class Backup extends Prepared {
name = FileUtils.getFileName(name);
FileOutputStream zip = new FileOutputStream(fileName);
ZipOutputStream out = new ZipOutputStream(zip);
out.putNextEntry(new ZipEntry(name + Constants.SUFFIX_DATA_FILE));
DiskFile file = db.getDataFile();
LogSystem log = db.getLog();
try {
log.flush();
log.updateKeepFiles(1);
int pos = -1;
int max = file.getReadCount();
while(true) {
pos = file.readDirect(pos, out);
if(pos < 0) {
break;
}
db.setProgress(DatabaseEventListener.STATE_BACKUP_FILE, name, pos, max);
}
out.closeEntry();
String fn = db.getName() + Constants.SUFFIX_DATA_FILE;
backupDiskFile(out, fn, db.getDataFile());
fn = db.getName() + Constants.SUFFIX_INDEX_FILE;
backupDiskFile(out, fn, db.getIndexFile());
ObjectArray list = log.getActiveLogFiles();
max = list.size();
for(int i=0; i<list.size(); i++) {
LogFile lf = (LogFile) list.get(i);
String fn = lf.getFileName();
out.putNextEntry(new ZipEntry(FileUtils.getFileName(fn)));
FileInputStream in = new FileInputStream(fn);
IOUtils.copyAndCloseInput(in, out);
out.closeEntry();
db.setProgress(DatabaseEventListener.STATE_BACKUP_FILE, name, i, max);
}
int todoLockDatabaseSomehow;
ArrayList fileList = FileBase.getDatabaseFiles(db.getDatabasePath(), name, true);
for(int i=0; i<fileList.size(); i++) {
String fn = (String) fileList.get(i);
int max = list.size();
// synchronize on the database, to avoid concurrent temp file creation / deletion / backup
synchronized(db.getLobSyncObject()) {
for(int i=0; i<list.size(); i++) {
LogFile lf = (LogFile) list.get(i);
fn = lf.getFileName();
backupFile(out, fn);
db.setProgress(DatabaseEventListener.STATE_BACKUP_FILE, name, i, max);
}
ArrayList fileList = FileBase.getDatabaseFiles(db.getDatabasePath(), name, true);
for(int i=0; i<fileList.size(); i++) {
fn = (String) fileList.get(i);
if(fn.endsWith(Constants.SUFFIX_HASH_FILE) || fn.endsWith(Constants.SUFFIX_LOB_FILE)) {
backupFile(out, fn);
}
}
}
int todoCopyLobFiles;
out.close();
zip.close();
} finally {
......@@ -91,6 +89,29 @@ public class Backup extends Prepared {
throw Message.convert(e);
}
}
private void backupDiskFile(ZipOutputStream out, String fileName, DiskFile file) throws SQLException, IOException {
Database db = session.getDatabase();
fileName = FileUtils.getFileName(fileName);
out.putNextEntry(new ZipEntry(fileName));
int pos = -1;
int max = file.getReadCount();
while(true) {
pos = file.readDirect(pos, out);
if(pos < 0) {
break;
}
db.setProgress(DatabaseEventListener.STATE_BACKUP_FILE, fileName, pos, max);
}
out.closeEntry();
}
private void backupFile(ZipOutputStream out, String fn) throws SQLException, IOException {
out.putNextEntry(new ZipEntry(FileUtils.getFileName(fn)));
FileInputStream in = new FileInputStream(fn);
IOUtils.copyAndCloseInput(in, out);
out.closeEntry();
}
public boolean isTransactional() {
return true;
......
......@@ -83,8 +83,10 @@ public abstract class Query extends Prepared {
if(lastResult != null && limit == lastLimit) {
if(sameResultAsLast(session, params, lastParameters, lastEvaluated)) {
lastResult = lastResult.createShallowCopy(session);
lastResult.reset();
return lastResult;
if(lastResult != null) {
lastResult.reset();
return lastResult;
}
}
}
lastParameters = params;
......
......@@ -201,4 +201,8 @@ public class ScriptBase extends Prepared implements DataHandler {
this.compressionAlgorithm = algorithm;
}
public Object getLobSyncObject() {
return this;
}
}
......@@ -4,19 +4,12 @@
*/
package org.h2.command.dml;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.SQLException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.h2.command.Prepared;
import org.h2.engine.Database;
import org.h2.engine.Session;
import org.h2.message.Message;
import org.h2.store.DiskFile;
/**
......@@ -124,32 +117,6 @@ public class TransactionCommand extends Prepared {
return 0;
}
private void backupTo(String fileName) throws SQLException {
int todoMoveToOwnCommand;
try {
FileOutputStream fileOut = new FileOutputStream("test.zip");
ZipOutputStream out = new ZipOutputStream(fileOut);
out.putNextEntry(new ZipEntry("test.data.db"));
DiskFile file = session.getDatabase().getDataFile();
try {
session.getDatabase().getLog().updateKeepFiles(1);
int pos = -1;
while(true) {
pos = file.readDirect(pos, out);
if(pos < 0) {
break;
}
}
out.close();
fileOut.close();
} finally {
session.getDatabase().getLog().updateKeepFiles(-1);
}
} catch(IOException e) {
throw Message.convert(e);
}
}
public boolean isTransactional() {
return true;
}
......
......@@ -49,11 +49,10 @@ public class CompressLZF implements Compressor {
return Compressor.LZF;
}
static final int HLOG = 14;
static final int HASH_SIZE = (1 << 14);
static final int MAX_LITERAL = (1 << 5);
static final int MAX_OFF = (1 << 13);
static final int MAX_REF = ((1 << 8) + (1 << 3));
private static final int HASH_SIZE = (1 << 14);
private static final int MAX_LITERAL = (1 << 5);
private static final int MAX_OFF = (1 << 13);
private static final int MAX_REF = ((1 << 8) + (1 << 3));
int first(byte[] in, int inPos) {
return (in[inPos] << 8) + (in[inPos + 1] & 255);
......@@ -79,11 +78,11 @@ public class CompressLZF implements Compressor {
System.arraycopy(empty, 0, hashTab, 0, HASH_SIZE);
}
int literals = 0;
int hval = first(in, inPos);
int hash = first(in, inPos);
while (true) {
if (inPos < inLen - 4) {
hval = next(hval, in, inPos);
int off = hash(hval);
hash = next(hash, in, inPos);
int off = hash(hash);
int ref = hashTab[off];
hashTab[off] = inPos;
off = inPos - ref - 1;
......@@ -110,11 +109,11 @@ public class CompressLZF implements Compressor {
}
out[outPos++] = (byte) off;
inPos += len;
hval = first(in, inPos);
hval = next(hval, in, inPos);
hashTab[hash(hval)] = inPos++;
hval = next(hval, in, inPos);
hashTab[hash(hval)] = inPos++;
hash = first(in, inPos);
hash = next(hash, in, inPos);
hashTab[hash(hash)] = inPos++;
hash = next(hash, in, inPos);
hashTab[hash(hash)] = inPos++;
continue;
}
} else if (inPos == inLen) {
......
......@@ -17,7 +17,11 @@ package org.h2.engine;
* - Compiling with JDK 1.3, 1.4, 1.5 and 1.6
*
* set path=C:\jdk1.3.1_19\bin;%PATH%
* set JAVA_HOME=C:\jdk1.3.1_19\bin
* set JAVA_HOME=C:\jdk1.3.1_19
* ant codeswitch_jdk13
* ant compile
* set path=C:\Programme\Java\jdk1.6.0\bin;%PATH%
* set JAVA_HOME=C:\Programme\Java\jdk1.6.0
* ant codeswitch_jdk16
* ant compile
*
......@@ -38,7 +42,7 @@ package org.h2.engine;
* - Change version(s) in performance.html; use latest versions of other databases
* - Run 'ant benchmark' (with JDK 1.4 currently)
* - Copy the benchmark results and update the performance page and diagram
* (remove rows 2*open/close, 2*executed statement)
* (remove 2*executed statement)
*
* - Documentation: if there are new files, add them to MergeDocs
* - Documentation: check if all javadoc files are in the index
......@@ -69,8 +73,8 @@ package org.h2.engine;
*/
public class Constants {
public static final int BUILD_ID = 40;
private static final String BUILD = "2007-01-17";
public static final int BUILD_ID = 41;
private static final String BUILD = "2007-01-30";
public static final int VERSION_MAJOR = 1;
public static final int VERSION_MINOR = 0;
......@@ -118,7 +122,6 @@ public class Constants {
public static final String SUFFIX_TRACE_FILE = ".trace.db";
public static final String SUFFIX_LOB_FILE = ".lob.db";
public static final String SUFFIX_TRACE_START_FILE = ".start";
public static final String SUFFIX_SUMMARY_FILE = ".sum.db";
public static final String SUFFIX_LOBS_DIRECTORY = ".lobs.db";
public static final String UTF8 = "UTF8";
......
......@@ -133,6 +133,7 @@ public class Database implements DataHandler {
private boolean optimizeReuseResults = true;
private String cacheType;
private boolean indexSummaryValid = true;
private Object lobSyncObject = new Object();
public static void setInitialPowerOffCount(int count) {
initialPowerOffCount = count;
......@@ -1483,4 +1484,8 @@ public class Database implements DataHandler {
return indexSummaryValid;
}
public Object getLobSyncObject() {
return lobSyncObject;
}
}
......@@ -153,7 +153,7 @@ public class FunctionAlias extends DbObject {
// need to set to default value otherwise the function can't be called at all
o = DataType.getDefaultForPrimitiveType(paramClass);
} else {
// NULL value for a java primitive: return NULL
// NULL for a java primitive: return NULL
return ValueNull.INSTANCE;
}
}
......
......@@ -203,7 +203,7 @@ public class Session implements SessionInterface {
Iterator it = unlinkSet.iterator();
while(it.hasNext()) {
Value v = (Value) it.next();
v.unlink(database);
v.unlink();
}
unlinkSet = null;
}
......
......@@ -53,6 +53,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
private String databaseName;
private String cipher;
private byte[] fileEncryptionKey;
private Object lobSyncObject = new Object();
private Transfer initTransfer(ConnectionInfo ci, String db, String server) throws IOException, SQLException {
int port = Constants.DEFAULT_SERVER_PORT;
......@@ -91,12 +92,12 @@ public class SessionRemote implements SessionInterface, DataHandler {
return trans;
}
private void switchOffAutocommitIfCluster() throws SQLException {
private void switchOffAutoCommitIfCluster() throws SQLException {
if(autoCommit && transferList.size() > 1) {
if(switchOffAutoCommit == null) {
switchOffAutoCommit = prepareCommand("SET AUTOCOMMIT FALSE");
}
// this will call setAutocommit(false)
// this will call setAutoCommit(false)
switchOffAutoCommit.executeUpdate();
// so we need to switch it on
autoCommit = true;
......@@ -109,7 +110,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
public void autoCommitIfCluster() throws SQLException {
if(autoCommit && transferList!= null && transferList.size() > 1) {
// server side autocommit is off because of race conditions
// server side auto commit is off because of race conditions
// (update set id=1 where id=0, but update set id=2 where id=0 is faster)
for(int i=0; i<transferList.size(); i++) {
Transfer transfer = (Transfer) transferList.get(i);
......@@ -217,7 +218,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
if(switchOffCluster) {
switchOffCluster();
}
switchOffAutocommitIfCluster();
switchOffAutoCommitIfCluster();
}
private void switchOffCluster() throws SQLException {
......@@ -379,4 +380,8 @@ public class SessionRemote implements SessionInterface, DataHandler {
return this;
}
public Object getLobSyncObject() {
return lobSyncObject;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论