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

--no commit message

--no commit message
上级 6391467e
...@@ -167,6 +167,13 @@ explain SELECT type, max(name) FROM TEST group by type; ...@@ -167,6 +167,13 @@ explain SELECT type, max(name) FROM TEST group by type;
SELECT type, max(name) FROM TEST group by type; SELECT type, max(name) FROM TEST group by type;
test with:
- large varchar columns (40 KB)
- not closing the database
read uncommitted and multi-threaded mode at the same time is dangerous read uncommitted and multi-threaded mode at the same time is dangerous
add @author add @author
......
...@@ -306,6 +306,19 @@ public class TestFunctions extends TestBase { ...@@ -306,6 +306,19 @@ public class TestFunctions extends TestBase {
return statement.executeQuery(); return statement.executeQuery();
} }
/**
* Test method to create a simple result set.
*
* @param count the number of rows
* @param ip an int
* @param bp a boolean
* @param fp a float
* @param dp a double
* @param lp a long
* @param byParam a byte
* @param sp a short
* @return a result set
*/
public static ResultSet simpleResultSet(Integer count, int ip, boolean bp, float fp, double dp, long lp, public static ResultSet simpleResultSet(Integer count, int ip, boolean bp, float fp, double dp, long lp,
byte byParam, short sp) throws SQLException { byte byParam, short sp) throws SQLException {
SimpleResultSet rs = new SimpleResultSet(); SimpleResultSet rs = new SimpleResultSet();
......
...@@ -34,6 +34,15 @@ public interface DbInterface { ...@@ -34,6 +34,15 @@ public interface DbInterface {
Result delete(Table table, String condition) throws SQLException; Result delete(Table table, String condition) throws SQLException;
/**
* Update the given table with the new values.
*
* @param table the table
* @param columns the columns to update
* @param values the new values
* @param condition the condition
* @return the result of the update
*/
Result update(Table table, Column[] columns, Value[] values, String condition) throws SQLException; Result update(Table table, Column[] columns, Value[] values, String condition) throws SQLException;
void setAutoCommit(boolean b) throws SQLException; void setAutoCommit(boolean b) throws SQLException;
......
...@@ -183,7 +183,7 @@ public class Value { ...@@ -183,7 +183,7 @@ public class Value {
return new Value(config, type, data); return new Value(config, type, data);
} }
public static Value getRandom(TestSynth config, int type, int precision, int scale, boolean mayBeNull) { static Value getRandom(TestSynth config, int type, int precision, int scale, boolean mayBeNull) {
Object data; Object data;
if (mayBeNull && config.random().getBoolean(20)) { if (mayBeNull && config.random().getBoolean(20)) {
return new Value(config, type, null); return new Value(config, type, null);
......
...@@ -24,8 +24,9 @@ Please provide any additional information below. ...@@ -24,8 +24,9 @@ Please provide any additional information below.
Corrupted database Corrupted database
I am sorry to say that, but it looks like a corruption problem. I am very interested in analyzing and solving this problem. Corruption problem have top priority for me. I have a few question: I am sorry to say that, but it looks like a corruption problem. I am very interested in analyzing and solving this problem. Corruption problems have top priority for me. I have a few question:
- Could you send the full stack trace of the exception?
- What is your database URL? - What is your database URL?
- What version H2 are you using? - What version H2 are you using?
- Did you use multiple connections? - Did you use multiple connections?
......
...@@ -31,7 +31,7 @@ public class TestSecurity extends TestBase { ...@@ -31,7 +31,7 @@ public class TestSecurity extends TestBase {
byte[] result = sha.getHash(data); byte[] result = sha.getHash(data);
return ByteUtils.convertBytesToString(result); return ByteUtils.convertBytesToString(result);
} }
private void testOneSHA(SHA256 sha) throws Exception { private void testOneSHA(SHA256 sha) throws Exception {
if (!getHashString(sha, new byte[] {}).equals( if (!getHashString(sha, new byte[] {}).equals(
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) { "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) {
...@@ -48,6 +48,22 @@ public class TestSecurity extends TestBase { ...@@ -48,6 +48,22 @@ public class TestSecurity extends TestBase {
"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8")) { "175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8")) {
throw new Exception("x"); throw new Exception("x");
} }
check("", "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855");
check("a", "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB");
check("abc", "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD");
check("message digest", "F7846F55CF23E14EEBEAB5B4E1550CAD5B509E3348FBC4EFA3A1413D393CB650");
check("abcdefghijklmnopqrstuvwxyz", "71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73");
check("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1");
check("12345678901234567890123456789012345678901234567890123456789012345678901234567890", "F371BC4A311F2B009EEF952DD83CA80E2B60026C8E935592D0F9C308453C813E");
StringBuffer buff = new StringBuffer(1000000);
buff.append('a');
check(buff.toString(), "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB");
}
void checkSHA256(String message, String expected) throws Exception {
SHA256 sha = new SHA256();
String hash = ByteUtils.convertBytesToString(sha.getHash(message.getBytes())).toUpperCase();
check(expected, hash);
} }
public void testXTEA() throws Exception { public void testXTEA() throws Exception {
......
...@@ -12,6 +12,7 @@ import java.io.IOException; ...@@ -12,6 +12,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
...@@ -33,6 +34,7 @@ public class Doclet { ...@@ -33,6 +34,7 @@ public class Doclet {
private static final boolean INTERFACES_ONLY = Boolean.getBoolean("h2.interfacesOnly"); private static final boolean INTERFACES_ONLY = Boolean.getBoolean("h2.interfacesOnly");
private int errorCount; private int errorCount;
private HashSet errors = new HashSet();
public static boolean start(RootDoc root) throws IOException { public static boolean start(RootDoc root) throws IOException {
return new Doclet().startDoc(root); return new Doclet().startDoc(root);
...@@ -149,8 +151,7 @@ public class Doclet { ...@@ -149,8 +151,7 @@ public class Doclet {
String name = field.name(); String name = field.name();
String text = field.commentText(); String text = field.commentText();
if (text == null || text.trim().length() == 0) { if (text == null || text.trim().length() == 0) {
System.out.println("Undocumented field? " + clazz.name() + "." + name + " " + field); addError("Undocumented field (" + clazz.name() + ".java:" + field.position().line() + ") " + name);
errorCount++;
} }
if (text.startsWith("INTERNAL")) { if (text.startsWith("INTERNAL")) {
continue; continue;
...@@ -355,8 +356,7 @@ public class Doclet { ...@@ -355,8 +356,7 @@ public class Doclet {
boolean setterOrGetter = name.startsWith("set") && method.parameters().length == 1; boolean setterOrGetter = name.startsWith("set") && method.parameters().length == 1;
setterOrGetter |= name.startsWith("get") && method.parameters().length == 0; setterOrGetter |= name.startsWith("get") && method.parameters().length == 0;
if (isInterface || !setterOrGetter) { if (isInterface || !setterOrGetter) {
System.out.println("Undocumented method? " + " (" + clazz.name() + ".java:" + method.position().line() +") " + name + " " + raw); addError("Undocumented method " + " (" + clazz.name() + ".java:" + method.position().line() +") " + clazz + "." + name + " " + raw);
errorCount++;
return true; return true;
} }
} }
...@@ -364,10 +364,15 @@ public class Doclet { ...@@ -364,10 +364,15 @@ public class Doclet {
return false; return false;
} }
private void addError(String s) {
if (errors.add(s)) {
System.out.println(s);
errorCount++;
}
}
private boolean doesOverride(MethodDoc method) { private boolean doesOverride(MethodDoc method) {
ClassDoc clazz = method.containingClass(); ClassDoc clazz = method.containingClass();
int test;
//System.out.println(clazz.name() + ". " + method.name());
ClassDoc[] ifs = clazz.interfaces(); ClassDoc[] ifs = clazz.interfaces();
int pc = method.parameters().length; int pc = method.parameters().length;
String name = method.name(); String name = method.name();
...@@ -385,14 +390,11 @@ int test; ...@@ -385,14 +390,11 @@ int test;
MethodDoc[] ms = c.methods(); MethodDoc[] ms = c.methods();
for (int j = 0; j < ms.length; j++) { for (int j = 0; j < ms.length; j++) {
MethodDoc m = ms[j]; MethodDoc m = ms[j];
//System.out.println(" " + c.name() + ". " + m);
if (m.name().equals(name) && m.parameters().length == pc) { if (m.name().equals(name) && m.parameters().length == pc) {
//System.out.println(" true");
return true; return true;
} }
} }
} }
//System.out.println(" false");
return false; return false;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论