提交 09f43661 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 9f7d4136
#Sun Mar 04 13:24:22 CET 2007
javac=javac
#Sun Apr 22 05:14:53 CEST 2007
benchmark.drivers.dir=D\:/data/java
version.name.maven=1.0.20070304
javac=javac
version.name.maven=1.0.20070320
jdk=1.4
......@@ -27,6 +27,7 @@ public class TestPreparedStatement extends TestBase {
deleteDb("preparedStatement");
Connection conn = getConnection("preparedStatement");
testArray(conn);
testUUIDGeneratedKeys(conn);
testSetObject(conn);
testPreparedSubquery(conn);
......@@ -44,6 +45,17 @@ public class TestPreparedStatement extends TestBase {
conn.close();
}
private void testArray(Connection conn) throws Exception {
PreparedStatement prep = conn.prepareStatement("select * from table(x int = ?) order by x");
prep.setObject(1, new Object[]{ new BigDecimal("1"), "2" });
ResultSet rs = prep.executeQuery();
rs.next();
check(rs.getString(1), "1");
rs.next();
check(rs.getString(1), "2");
checkFalse(rs.next());
}
private void testUUIDGeneratedKeys(Connection conn) throws Exception {
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST_UUID(id UUID DEFAULT random_UUID() PRIMARY KEY)");
......
......@@ -9,6 +9,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
......@@ -34,6 +35,7 @@ public class TestResultSet extends TestBase {
stat=conn.createStatement();
testArray();
testLimitMaxRows();
trace("max rows="+stat.getMaxRows());
......@@ -49,7 +51,6 @@ public class TestResultSet extends TestBase {
testDatetimeWithCalendar();
testBlob();
testClob();
testAutoIncrement();
conn.close();
......@@ -774,6 +775,44 @@ public class TestResultSet extends TestBase {
rs.next();
stat.execute("DROP TABLE TEST");
}
void testArray() throws Exception {
trace("Test ARRAY");
ResultSet rs;
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE ARRAY)");
PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)");
prep.setInt(1, 1);
prep.setObject(2, new Object[]{new Integer(1), new Integer(2)});
prep.execute();
prep.setInt(1, 2);
prep.setObject(2, new Object[]{new Integer(11), new Integer(12)});
prep.execute();
rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID");
rs.next();
check(rs.getInt(1), 1);
Object[] list = (Object[]) rs.getObject(2);
check(((Integer)list[0]).intValue(), 1);
check(((Integer)list[1]).intValue(), 2);
Array array = rs.getArray(2);
Object[] list2 = (Object[]) array.getArray();
check(((Integer)list2[0]).intValue(), 1);
check(((Integer)list2[1]).intValue(), 2);
list2 = (Object[]) array.getArray(2, 1);
check(((Integer)list2[0]).intValue(), 2);
rs.next();
check(rs.getInt(1), 2);
list = (Object[]) rs.getObject(2);
check(((Integer)list[0]).intValue(), 11);
check(((Integer)list[1]).intValue(), 12);
array = rs.getArray(2);
list2 = (Object[]) array.getArray();
check(((Integer)list2[0]).intValue(), 11);
check(((Integer)list2[1]).intValue(), 12);
list2 = (Object[]) array.getArray(2, 1);
check(((Integer)list2[0]).intValue(), 12);
checkFalse(rs.next());
stat.execute("DROP TABLE TEST");
}
byte[] readAllBytes(InputStream in) throws Exception {
if(in==null) {
......
......@@ -129,7 +129,7 @@ public abstract class TestHalt extends TestBase {
disconnect();
for(int i=0; i<10; i++) {
traceOperation("backing up " + sequenceId);
Backup.backupFiles(BASE_DIR + "/haltSeq"+ sequenceId + ".zip", BASE_DIR, null);
Backup.execute(BASE_DIR + "/haltSeq"+ sequenceId + ".zip", BASE_DIR, null, true);
sequenceId++;
// int operations = OP_INSERT;
// OP_DELETE = 1, OP_UPDATE = 2, OP_SELECT = 4;
......@@ -155,7 +155,7 @@ public abstract class TestHalt extends TestBase {
p.destroy();
try {
traceOperation("backing up " + sequenceId);
Backup.backupFiles(BASE_DIR + "/haltSeq"+ sequenceId + ".zip", BASE_DIR, null);
Backup.execute(BASE_DIR + "/haltSeq"+ sequenceId + ".zip", BASE_DIR, null, true);
// new File(BASE_DIR + "/haltSeq" + (sequenceId-20) + ".zip").delete();
connect();
testCheckAfterCrash();
......
......@@ -7,7 +7,7 @@ package org.h2.test.unit;
import java.sql.*;
import org.h2.test.TestBase;
import org.h2.tools.Backup;
import org.h2.tools.Script;
import org.h2.tools.ChangePassword;
import org.h2.tools.DeleteDbFiles;
import org.h2.tools.RunScript;
......@@ -44,9 +44,9 @@ public class TestTools extends TestBase {
conn.createStatement().execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)");
conn.createStatement().execute("INSERT INTO TEST VALUES(1, 'Hello')");
conn.close();
Backup.main(new String[]{"-url", url, "-user", user, "-password", password, "-script", fileName, "-options", "nodata", "compression", "lzf", "cipher", "xtea", "password", "'123'"});
Script.main(new String[]{"-url", url, "-user", user, "-password", password, "-file", fileName, "-options", "nodata", "compression", "lzf", "cipher", "xtea", "password", "'123'"});
DeleteDbFiles.main(new String[]{"-dir", BASE_DIR, "-db", "utils", "-quiet"});
RunScript.main(new String[]{"-url", url, "-user", user, "-password", password, "-script", fileName, "-options", "compression", "lzf", "cipher", "xtea", "password", "'123'"});
RunScript.main(new String[]{"-url", url, "-user", user, "-password", password, "-file", fileName, "-options", "compression", "lzf", "cipher", "xtea", "password", "'123'"});
conn = DriverManager.getConnection("jdbc:h2:" + BASE_DIR+ "/utils", "sa", "abc");
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST");
checkFalse(rs.next());
......
......@@ -445,8 +445,19 @@ truncating ronni ptn avalon nielsen hammant picked sequoia continuent deebee pau
lister testa testb tar von
### check those again:
populate slowly xacon inser maxbqualsize counter regards attaching official xatest xids rmerr xadb rdonly occured maxgtridsize bordea con patches suffixer risky
populate slowly xacon inser maxbqualsize counter regards attaching official xatest
xids rmerr xadb rdonly occured maxgtridsize bordea con patches suffixer risky
portuguese parameterized interpret construct maximus seem solo portugu tds
symmetrical printed syb conversions doe ntfs insertquery interested come man
blobtest overload hen datetimes stolen firstly fild mission europe instruct instantiated
recid selectquery msg japan portugal atlas dbsolo henplus soft equivalent watch
createquery securing unambiguously presume umambiguously realised printing
comulative largely perhaps inputting restores observation oversight actuality behaviours
isn truly toptier older meant pavel byteblob benchmarking regarding great unqualified
wanted thoughts europeu astonished acceptable blobtable retrieval wasn demonstrate
incidentally brutal carefully pervasive testlob mydatetime antonio casqueiro sybase fourth
pad microsystems dullesopen rpad spot lpad ganelin sssz testabc pst dumping lots
chdh biz inventec
### evaluatable > evaluable
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论