提交 554a5c0f authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 22be687e
......@@ -18,7 +18,12 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Calling execute() or prepareStatement() with null as the SQL statement
<ul><li>Identifiers with a digit and then a dollar sign didn't work. Example: A1$B.
</li><li>MS SQL Server compatibility: support for linked tables with
NVARCHAR, NCHAR, NCLOB, and LONGNVARCHAR.
</li><li>Android: Workaround for a problem when using read-only databases in zip files
(skip seems to be implemented incorrectly on the Android system).
</li><li>Calling execute() or prepareStatement() with null as the SQL statement
now throws an exception.
</li><li>Benchmark: the number of executed statements was incorrect. The H2 database
was loaded at the beginning of the test to collect results, now it is loaded at the very end.
......
......@@ -107,7 +107,7 @@ One query where HSQLDB is slow is a two-table join:
</p>
<pre>
SELECT COUNT(DISTINCT S_I_ID) FROM ORDER_LINE, STOCK
WHERE OL_W_ID=? AND OL_D_ID=? AND OL_O_ID&lt;? AND OL_O_ID>=?
WHERE OL_W_ID=? AND OL_D_ID=? AND OL_O_ID&lt;? AND OL_O_ID&gt;=?
AND S_W_ID=? AND S_I_ID=OL_I_ID AND S_QUANTITY&lt;?
</pre>
<p>
......@@ -172,6 +172,20 @@ SQLite was not tested because the JDBC driver doesn't support transactions.
<h3>About this Benchmark</h3>
<h4>How to Run</h4>
<p>
This test was executed as follows:
</p>
<pre>
build benchmark
</pre>
<h4>Separate Process per Database</h4>
<p>
For each database, a new process is started, to ensure the previous test does not impact
the current test.
</p>
<h4>Number of Connections</h4>
<p>
This is mostly a single-connection benchmark.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,7 +12,6 @@ import java.text.Collator;
import org.h2.command.Prepared;
import org.h2.compress.Compressor;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.engine.Database;
import org.h2.engine.Mode;
import org.h2.engine.Session;
......@@ -99,21 +98,20 @@ public class Set extends Prepared {
StringBuffer buff = new StringBuffer();
buff.append(stringValue);
if (stringValue.equals(CompareMode.OFF)) {
compareMode = new CompareMode(null, null, 0);
compareMode = new CompareMode(null, 0);
} else {
Collator coll = CompareMode.getCollator(stringValue);
compareMode = new CompareMode(coll, stringValue, SysProperties.getCollatorCacheSize());
int strength = getIntValue();
buff.append(" STRENGTH ");
if (getIntValue() == Collator.IDENTICAL) {
if (strength == Collator.IDENTICAL) {
buff.append("IDENTICAL");
} else if (getIntValue() == Collator.PRIMARY) {
} else if (strength == Collator.PRIMARY) {
buff.append("PRIMARY");
} else if (getIntValue() == Collator.SECONDARY) {
} else if (strength == Collator.SECONDARY) {
buff.append("SECONDARY");
} else if (getIntValue() == Collator.TERTIARY) {
} else if (strength == Collator.TERTIARY) {
buff.append("TERTIARY");
}
coll.setStrength(getIntValue());
compareMode = new CompareMode(stringValue, strength);
}
addOrUpdateSetting(name, buff.toString(), 0);
database.setCompareMode(compareMode);
......@@ -341,7 +339,7 @@ public class Set extends Prepared {
private void addOrUpdateSetting(String name, String s, int v) throws SQLException {
Database database = session.getDatabase();
if (database.getReadOnly()) {
if (database.isReadOnly()) {
return;
}
Setting setting = database.findSetting(name);
......
......@@ -170,7 +170,7 @@ public class Database implements DataHandler {
private boolean reconnectChangePending;
public Database(String name, ConnectionInfo ci, String cipher) throws SQLException {
this.compareMode = new CompareMode(null, null, 0);
this.compareMode = new CompareMode(null, 0);
this.persistent = ci.isPersistent();
this.filePasswordHash = ci.getFilePasswordHash();
this.databaseName = name;
......@@ -1768,7 +1768,7 @@ public class Database implements DataHandler {
}
}
public boolean getReadOnly() {
public boolean isReadOnly() {
return readOnly;
}
......@@ -2046,7 +2046,7 @@ public class Database implements DataHandler {
}
}
public boolean getIndexSummaryValid() {
public boolean isIndexSummaryValid() {
return indexSummaryValid;
}
......
......@@ -691,7 +691,7 @@ public class Function extends Expression implements FunctionCall {
result = ValueBoolean.get(session.getAutoCommit());
break;
case READONLY:
result = ValueBoolean.get(database.getReadOnly());
result = ValueBoolean.get(database.isReadOnly());
break;
case DATABASE_PATH: {
String path = database.getDatabasePath();
......
......@@ -85,7 +85,7 @@ public class LogFile {
unwritten = new ObjectArray();
try {
readHeader();
if (!log.getDatabase().getReadOnly()) {
if (!log.getDatabase().isReadOnly()) {
writeHeader();
}
pos = getBlock();
......@@ -243,7 +243,7 @@ public class LogFile {
int blocks = in.readInt();
if (blocks < 0) {
return true;
} else if (blocks == 0 && !database.getReadOnly()) {
} else if (blocks == 0 && !database.isReadOnly()) {
truncate(pos);
return false;
}
......@@ -359,7 +359,7 @@ public class LogFile {
* the file.
*/
void redoAllGoEnd() throws SQLException {
boolean readOnly = logSystem.getDatabase().getReadOnly();
boolean readOnly = logSystem.getDatabase().isReadOnly();
long length = file.length();
if (length <= FileStore.HEADER_LENGTH) {
return;
......
......@@ -602,7 +602,7 @@ public class LogSystem {
if (summary != null) {
currentLog.addSummary(true, summary);
}
if (database.getLogIndexChanges() || database.getIndexSummaryValid()) {
if (database.getLogIndexChanges() || database.isIndexSummaryValid()) {
file = database.getIndexFile();
summary = file.getSummary();
if (summary != null) {
......
......@@ -480,7 +480,7 @@ public class DiskFile implements CacheWriter {
public void close() throws SQLException {
synchronized (database) {
SQLException closeException = null;
if (!database.getReadOnly()) {
if (!database.isReadOnly()) {
try {
flush();
} catch (SQLException e) {
......
......@@ -246,7 +246,7 @@ public class TableData extends Table implements RecordReader {
// need to update, because maybe the index is rebuilt at startup,
// and so the head pos may have changed, which needs to be stored now.
// addSchemaObject doesn't update the sys table at startup
if (index.getIndexType().getPersistent() && !database.getReadOnly()
if (index.getIndexType().getPersistent() && !database.isReadOnly()
&& !database.getLog().containsInDoubtTransactions()) {
// can not save anything in the log file if it contains in-doubt transactions
database.update(session, index);
......
......@@ -10,6 +10,7 @@ import java.text.CollationKey;
import java.text.Collator;
import java.util.Locale;
import org.h2.constant.SysProperties;
import org.h2.util.SmallLRUCache;
import org.h2.util.StringUtils;
......@@ -35,13 +36,17 @@ public class CompareMode {
* The cache is used to speed up comparison when using a collator;
* CollationKey objects are cached.
*
* @param collator the collator or null
* @param name the collation name or null
* @param cacheSize the number of entries in the CollationKey cache
* @param strength the collation strength
*/
public CompareMode(Collator collator, String name, int cacheSize) {
this.collator = collator;
if (collator != null && cacheSize != 0) {
public CompareMode(String name, int strength) {
this.collator = CompareMode.getCollator(name);
int cacheSize = 0;
if (collator != null) {
this.collator.setStrength(strength);
cacheSize = SysProperties.getCollatorCacheSize();
}
if (cacheSize != 0) {
collationKeys = new SmallLRUCache(cacheSize);
} else {
collationKeys = null;
......@@ -140,6 +145,9 @@ public class CompareMode {
* @return the collator
*/
public static Collator getCollator(String name) {
if (name == null) {
return null;
}
Collator result = null;
if (name.length() == 2) {
Locale locale = new Locale(name.toLowerCase(), "");
......
......@@ -286,12 +286,22 @@ java org.h2.test.TestAll timer
System.setProperty("h2.maxMemoryRowsDistinct", "128");
System.setProperty("h2.check2", "true");
// 2009-05-15: 25 test fail with page store (first loop)
// System.setProperty("h2.pageStore", "true");
/*
what do other databases do when calling prepareStatement(null)
and execute(null)?
index grows:
runscript from '~/Desktop/merge.sql';
create table test(id int, name varchar, primary key(id, name));
@LOOP 10000 merge into test(id, name) values(?, 'test' || ?);
BaseIndex or TableData should have its own compareMode
(default is: Database.compareMode when created).
standard: COLLATE for each column (MySQL, SQL Server)
stored in the pageStore as well.
check syntax in other databases.
this mean changing the collation is allowed if there are tables.
test case for running out of disk space (using a special file system)
......
......@@ -121,6 +121,7 @@ public class TestFuzzOptimizations extends TestBase {
group += " ORDER BY 1, 2, 3";
List a = db.query(x + "TEST" + group);
List b = db.query(x + "TEST_INDEXED" + group);
assertEquals(a.toString(), b.toString());
assertTrue(a.equals(b));
}
db.execute("DROP TABLE TEST_INDEXED");
......
create table t1$2(id int);
drop table t1$2;
create table test(id int primary key) as select x from system_range(1, 200);
delete from test;
insert into test(id) values(1);
......
......@@ -27,7 +27,7 @@ public class TestPattern extends TestBase {
}
public void test() throws SQLException {
CompareMode mode = new CompareMode(null, null, 100);
CompareMode mode = new CompareMode(null, 0);
CompareLike comp = new CompareLike(mode, null, null, null, false);
test(comp, "B", "%_");
test(comp, "A", "A%");
......
......@@ -29,7 +29,7 @@ import org.h2.value.ValueInt;
*/
public class TestValueHashMap extends TestBase implements DataHandler {
CompareMode compareMode = new CompareMode(null, null, 0);
CompareMode compareMode = new CompareMode(null, 0);
/**
* Run just this test.
......
......@@ -588,4 +588,5 @@ animate scaladoc models disadvantages vladykin sergi trims requesting
handing bonita placed euros embeds reliability singular unregister quotas
overall httpdocs tigris eclemma separates underscore yajsw she her truncating
relocating smtps smtp osde joist catching guesses delimiters shortlist sheet
rowspan cheat partitioning datepart
\ No newline at end of file
rowspan cheat partitioning datepart dreamsource toussi locates fred
longnvarchar collate localdb
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论