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

--no commit message

--no commit message
上级 481146ad
...@@ -20,9 +20,9 @@ public class Function { ...@@ -20,9 +20,9 @@ public class Function {
Class.forName("org.h2.Driver"); Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:mem:", "sa", ""); Connection conn = DriverManager.getConnection("jdbc:h2:mem:", "sa", "");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE ALIAS ISPRIME FOR \"org.h2.samples.Function.isPrime\" "); stat.execute("CREATE ALIAS IS_PRIME FOR \"org.h2.samples.Function.isPrime\" ");
ResultSet rs; ResultSet rs;
rs = stat.executeQuery("SELECT ISPRIME(X), X FROM SYSTEM_RANGE(1, 20) ORDER BY X"); rs = stat.executeQuery("SELECT IS_PRIME(X), X FROM SYSTEM_RANGE(1, 20) ORDER BY X");
while(rs.next()) { while(rs.next()) {
boolean isPrime = rs.getBoolean(1); boolean isPrime = rs.getBoolean(1);
if(isPrime) { if(isPrime) {
......
...@@ -17,27 +17,27 @@ INSERT INTO ITEM VALUES(20, ...@@ -17,27 +17,27 @@ INSERT INTO ITEM VALUES(20,
<b>Changes and new functionality:</b> <b>Changes and new functionality:</b>
<ul> <ul>
<li>The Console is now translated to Japanese thanks to <li>The Console is now translated to Japanese thanks to
IKEMOTO, Masahiro (ikeyan (at) arizona (dot) ne (dot) jp). IKEMOTO, Masahiro (ikeyan (at) arizona (dot) ne (dot) jp).
<li>The database engine can now be compiled with JDK 1.3 using ant codeswitch_jdk13. <li>The database engine can now be compiled with JDK 1.3 using ant codeswitch_jdk13.
There are still some limitations, and the ant script to build the jar does not work yet. There are still some limitations, and the ant script to build the jar does not work yet.
<li>SCRIPT NODATA now writes the row count for each table. <li>SCRIPT NODATA now writes the row count for each table.
<li>Timestamps with timezone information (Z or +/-hh:mm) and dates before year 1 <li>Timestamps with timezone information (Z or +/-hh:mm) and dates before year 1
can now be parsed. However dates before year 1 are not formatted correctly. can now be parsed. However dates before year 1 are not formatted correctly.
</ul> </ul>
<b>Bugfixes:</b> <b>Bugfixes:</b>
<ul> <ul>
<li>Fixed a problem where data in the log file was not written to the data file <li>Fixed a problem where data in the log file was not written to the data file
(recovery failure) after a crash, if an index was deleted previously. (recovery failure) after a crash, if an index was deleted previously.
<li>Setting the collation (SET COLLATOR) was very slow on some systems (up to 24 seconds). <li>Setting the collation (SET COLLATOR) was very slow on some systems (up to 24 seconds).
<li>Selecting a column using the syntax schemaName.tableName.columName did not work in all cases. <li>Selecting a column using the syntax schemaName.tableName.columName did not work in all cases.
<li>When stopping the TCP server from an application and immediately afterwards starting <li>When stopping the TCP server from an application and immediately afterwards starting
it again using a different TCP password, an exception was thrown sometimes. it again using a different TCP password, an exception was thrown sometimes.
<li>Now PreparedStatement.setBigDecimal(..) can only be called with an object of <li>Now PreparedStatement.setBigDecimal(..) can only be called with an object of
type java.math.BigDecimal. Derived classes are not allowed any more. Many thanks to type java.math.BigDecimal. Derived classes are not allowed any more. Many thanks to
Maciej Wegorkiewicz for finding this problem. Maciej Wegorkiewicz for finding this problem.
<li>It was possible to manipulate values in the byte array after calling PreparedStatement.setBytes, <li>It was possible to manipulate values in the byte array after calling PreparedStatement.setBytes,
and this could lead to problems if the same byte array was used again. Now the byte array and this could lead to problems if the same byte array was used again. Now the byte array
is copied if required. is copied if required.
<li>Date, time and timestamp objects were cloned in cases where it was not required. Fixed. <li>Date, time and timestamp objects were cloned in cases where it was not required. Fixed.
</ul> </ul>
For future plans, see the new ''Roadmap'' page on the web site. For future plans, see the new ''Roadmap'' page on the web site.
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
Security: Security:
- TCP Server: Can now specifiy a password (tcpPassword). - TCP Server: Can now specify a password (tcpPassword).
- New option -ifExists for the TCP and ODBC server - New option -ifExists for the TCP and ODBC server
to disallow creating new databases. to disallow creating new databases.
......
...@@ -86,20 +86,36 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -86,20 +86,36 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
TestAll test = new TestAll(); TestAll test = new TestAll();
test.printSystem(); test.printSystem();
// Hi i found one small nasty bug with h2 database. When i use prepared statement on tables that have primary key UUID DEFAULT random_UUID(), and when i call getGeneratedKeys() method I only get (long) 0 as result, instead of random_uuid. // It would be nice if the donation link opened a new window. I could not see where I was at in the address bar while filling out the form.
// And if I use IDENTITY type for primary ket i get corect value from methord PreparedStatement.getGeneratedKeys(). Problem is with UUID and random_uuid() combination.
// NULL || 'X' should probably return null by default // support % operator (modulo)
// change default to read committed transaction isolation // java -cp .;%H2DRIVERS% org.h2.tools.RunScript -continueOnError -driver org.h2.Driver -url jdbc:h2:test -user sa -password sa -script c:/temp/test.sql
// java -cp .;%H2DRIVERS% org.h2.tools.RunScript -continueOnError -driver com.mysql.jdbc.Driver -url jdbc:mysql://localhost/test -user sa -password sa -script c:/temp/test.sql
// java -cp .;%H2DRIVERS% org.h2.tools.RunScript -continueOnError -driver org.apache.derby.jdbc.EmbeddedDriver -url jdbc:derby:test3;create=true -user sa -password sa -script c:/temp/test.sql
// java -cp .;%H2DRIVERS% org.h2.tools.RunScript -continueOnError -driver org.postgresql.Driver -url jdbc:postgresql:jpox2 -user sa -password sa -script c:/temp/test.sql
// http://monetdb.cwi.nl/Assets/DBtapestry100K.sql
// (delete all objects doesn't work for linux)
// Hi,
// Thanks for your feedback! Yes, this is a bug, it will be fixed in the next release.
// Thomas
// test backup
// backup: lobs, index
// improve TestHalt
// BACKUP: compare sql syntax with other databases
// Hot backup (incremental backup, online backup): backup data, log, index? files // Hot backup (incremental backup, online backup): backup data, log, index? files
// ESC/Java (http://secure.ucd.ie/products/opensource/ESCJava2/)
// GroovyServlet
// Cluster: hot deploy (adding a node on runtime) // Cluster: hot deploy (adding a node on runtime)
// system property for base directory (h2.baseDir)
// SELECT ... FROM TA, TB, TC WHERE TC.COL3 = TA.COL1 AND TC.COL3=TB.COL2 AND TC.COL4 = 1
// The query implies TA.COL1 = TB.COL2 but does not explicitly set this condition.
// "trace.db" is created in the current directory
// dataSource.setLogWriter() seems to have no effect? // dataSource.setLogWriter() seems to have no effect?
// CHAR data type
// DROP TABLE TEST; // DROP TABLE TEST;
// CREATE TABLE TEST(C CHAR(10)); // CREATE TABLE TEST(C CHAR(10));
// INSERT INTO TEST VALUES('1'); // INSERT INTO TEST VALUES('1');
......
...@@ -120,7 +120,7 @@ public class BenchC implements Bench { ...@@ -120,7 +120,7 @@ public class BenchC implements Bench {
+ " TERMINAL INT,\n" + " OPERATION INT,\n" + " TERMINAL INT,\n" + " OPERATION INT,\n"
+ " RESPONSE_TIME INT,\n" + " PROCESSING_TIME INT,\n" + " RESPONSE_TIME INT,\n" + " PROCESSING_TIME INT,\n"
+ " KEYING_TIME INT,\n" + " THINK_TIME INT,\n" + " KEYING_TIME INT,\n" + " THINK_TIME INT,\n"
+ " SUCCESSFULL INT,\n" + " NOW TIMESTAMP)" }; + " SUCCESSFUL INT,\n" + " NOW TIMESTAMP)" };
public void init(Database db, int size) throws Exception { public void init(Database db, int size) throws Exception {
this.db = db; this.db = db;
......
...@@ -20,6 +20,21 @@ public class TestCsv extends TestBase { ...@@ -20,6 +20,21 @@ public class TestCsv extends TestBase {
testAsTable(); testAsTable();
testWriteRead(); testWriteRead();
testRead(); testRead();
testPipe();
}
private void testPipe() throws Exception {
deleteDb("csv");
Connection conn = getConnection("csv");
Statement stat = conn.createStatement();
stat.execute("call csvwrite('"+BASE_DIR+"/test.csv', 'select 1 id, ''Hello'' name', 'utf-8', '|')");
ResultSet rs = stat.executeQuery("select * from csvread('"+BASE_DIR+"/test.csv', null, 'utf-8', '|')");
check(rs.next());
check(rs.getInt(1), 1);
check(rs.getString(2), "Hello");
checkFalse(rs.next());
new File(BASE_DIR+"/test.csv").delete();
conn.close();
} }
private void testAsTable() throws Exception { private void testAsTable() throws Exception {
...@@ -38,7 +53,6 @@ public class TestCsv extends TestBase { ...@@ -38,7 +53,6 @@ public class TestCsv extends TestBase {
checkFalse(rs.next()); checkFalse(rs.next());
new File(BASE_DIR+"/test.csv").delete(); new File(BASE_DIR+"/test.csv").delete();
conn.close(); conn.close();
} }
public void testRead() throws Exception { public void testRead() throws Exception {
......
...@@ -68,7 +68,7 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -68,7 +68,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
stateName = "Recover"; stateName = "Recover";
break; break;
default: default:
TestBase.logError("unknownn state: " + state, null); TestBase.logError("unknown state: " + state, null);
stateName = "? " + name; stateName = "? " + name;
} }
try { try {
......
...@@ -95,7 +95,7 @@ public class TestPowerOff extends TestBase { ...@@ -95,7 +95,7 @@ public class TestPowerOff extends TestBase {
} }
deleteDb(dir, dbName); deleteDb(dir, dbName);
Random random = new Random(1); Random random = new Random(1);
Constants.RUN_FINALIZERS = false; Constants.RUN_FINALIZE = false;
int repeat = getSize(1, 20); int repeat = getSize(1, 20);
for(int i=0; i<repeat; i++) { for(int i=0; i<repeat; i++) {
Connection conn = getConnection(url); Connection conn = getConnection(url);
......
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
create table Foo (A varchar(20), B integer);
> ok
insert into Foo (A, B) values ('abcd', 1), ('abcd', 2);
> update count: 2
select * from Foo where A like 'abc%' escape '\' AND B=1;
> A B
> ---- -
> abcd 1
> rows: 1
drop table Foo;
> ok
create memory table orders ( orderid varchar(10), name varchar(20), custid varchar(10), completed numeric(1) not null, verified numeric(1) ); create memory table orders ( orderid varchar(10), name varchar(20), custid varchar(10), completed numeric(1) not null, verified numeric(1) );
> ok > ok
......
create table A ( ID integer, a1 varchar(20) );
create table B ( ID integer, AID integer, b1 varchar(20));
create table C ( ID integer, BId integer, c1 varchar(20));
insert into A (ID, a1) values (1, 'a1');
insert into A (ID, a1) values (2, 'a2');
select count(*) from A left outer join (B inner join C on C.BID=B.ID ) on B.AID=A.ID where A.id=1;
> 1;
select count(*) from A left outer join (B left join C on C.BID=B.ID ) on B.AID=A.ID where A.id=1;
> 1;
select count(*) from A left outer join B on B.AID=A.ID inner join C on C.BID=B.ID where A.id=1;
> 0;
select count(*) from (A left outer join B on B.AID=A.ID) inner join C on C.BID=B.ID where A.id=1;
> 0;
drop table a, b, c;
create schema a; create schema a;
create table a.test(id int); create table a.test(id int);
insert into a.test values(1); insert into a.test values(1);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论