Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4461f5e6
提交
4461f5e6
authored
1月 18, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
9a0e05a6
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
84 行增加
和
27 行删除
+84
-27
ant-build.properties
h2/ant-build.properties
+1
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+4
-1
JdbcBlob.java
h2/src/main/org/h2/jdbc/JdbcBlob.java
+19
-14
JdbcClob.java
h2/src/main/org/h2/jdbc/JdbcClob.java
+3
-3
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+7
-0
FileSystemDisk.java
h2/src/main/org/h2/store/fs/FileSystemDisk.java
+7
-1
IOUtils.java
h2/src/main/org/h2/util/IOUtils.java
+11
-2
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+5
-0
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+2
-0
RandomGen.java
h2/src/test/org/h2/test/synth/sql/RandomGen.java
+25
-5
没有找到文件。
h2/ant-build.properties
浏览文件 @
4461f5e6
#
Thu Jan 17 08:51:17
CET 2008
#
Fri Jan 18 08:04:40
CET 2008
javac
=
javac
javac
=
javac
benchmark.drivers.dir
=
C
\:
/data/java
benchmark.drivers.dir
=
C
\:
/data/java
path.servlet.jar
=
C
\:
/data/classpath/servlet-api.jar
path.servlet.jar
=
C
\:
/data/classpath/servlet-api.jar
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
4461f5e6
...
@@ -1997,7 +1997,10 @@ public class Parser {
...
@@ -1997,7 +1997,10 @@ public class Parser {
read
();
read
();
if
(
indexed
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
INT
)
{
if
(
indexed
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
INT
)
{
if
(
indexedParameterList
==
null
)
{
if
(
indexedParameterList
==
null
)
{
if
(
parameters
.
size
()
>
0
)
{
if
(
parameters
==
null
)
{
// this can occur when parsing expressions only (for example check constraints)
throw
getSyntaxError
();
}
else
if
(
parameters
.
size
()
>
0
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS
);
throw
Message
.
getSQLException
(
ErrorCode
.
CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS
);
}
}
indexedParameterList
=
new
ObjectArray
();
indexedParameterList
=
new
ObjectArray
();
...
...
h2/src/main/org/h2/jdbc/JdbcBlob.java
浏览文件 @
4461f5e6
...
@@ -66,7 +66,7 @@ public class JdbcBlob extends TraceObject implements Blob {
...
@@ -66,7 +66,7 @@ public class JdbcBlob extends TraceObject implements Blob {
}
}
return
size
;
return
size
;
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
c
onvert
(
e
);
throw
logAndC
onvert
(
e
);
}
}
}
}
...
@@ -108,7 +108,7 @@ public class JdbcBlob extends TraceObject implements Blob {
...
@@ -108,7 +108,7 @@ public class JdbcBlob extends TraceObject implements Blob {
}
}
return
out
.
toByteArray
();
return
out
.
toByteArray
();
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
c
onvert
(
e
);
throw
logAndC
onvert
(
e
);
}
}
}
}
...
@@ -134,8 +134,13 @@ public class JdbcBlob extends TraceObject implements Blob {
...
@@ -134,8 +134,13 @@ public class JdbcBlob extends TraceObject implements Blob {
* @return the input stream
* @return the input stream
*/
*/
public
InputStream
getBinaryStream
()
throws
SQLException
{
public
InputStream
getBinaryStream
()
throws
SQLException
{
debugCodeCall
(
"getBinaryStream"
);
try
{
return
value
.
getInputStream
();
debugCodeCall
(
"getBinaryStream"
);
checkClosed
();
return
value
.
getInputStream
();
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
}
}
}
/**
/**
...
@@ -148,15 +153,15 @@ public class JdbcBlob extends TraceObject implements Blob {
...
@@ -148,15 +153,15 @@ public class JdbcBlob extends TraceObject implements Blob {
/**
/**
* [Not supported] Searches a pattern and return the position.
* [Not supported] Searches a pattern and return the position.
*
* @param pattern the pattern to search
* @param start the index, the first byte is at position 1
* @return the position (first byte is at position 1), or -1 for not found
*/
*/
public
long
position
(
byte
[]
pattern
,
long
start
)
throws
SQLException
{
public
long
position
(
byte
[]
pattern
,
long
start
)
throws
SQLException
{
debugCode
(
"position(pattern, "
+
start
+
");"
);
debugCode
(
"position(pattern, "
+
start
+
");"
);
throw
Message
.
getUnsupportedException
();
throw
Message
.
getUnsupportedException
();
// TODO test
// TODO test
// *
// * @param pattern the pattern to search
// * @param start the index, the first byte is at position 1
// * @return the position (first byte is at position 1), or -1 for not found
// try {
// try {
// debugCode("position(pattern, "+start+");");
// debugCode("position(pattern, "+start+");");
// if(pattern == null) {
// if(pattern == null) {
...
@@ -193,21 +198,21 @@ public class JdbcBlob extends TraceObject implements Blob {
...
@@ -193,21 +198,21 @@ public class JdbcBlob extends TraceObject implements Blob {
// }
// }
// return -1;
// return -1;
// } catch(Throwable e) {
// } catch(Throwable e) {
// throw
Message.c
onvert(e);
// throw
logAndC
onvert(e);
// }
// }
}
}
/**
/**
* [Not supported] Searches a pattern and return the position.
* [Not supported] Searches a pattern and return the position.
*
* @param pattern the pattern to search
* @param start the index, the first byte is at position 1
* @return the position (first byte is at position 1), or -1 for not found
*/
*/
public
long
position
(
Blob
blobPattern
,
long
start
)
throws
SQLException
{
public
long
position
(
Blob
blobPattern
,
long
start
)
throws
SQLException
{
debugCode
(
"position(blobPattern, "
+
start
+
");"
);
debugCode
(
"position(blobPattern, "
+
start
+
");"
);
throw
Message
.
getUnsupportedException
();
throw
Message
.
getUnsupportedException
();
// *
// * @param pattern the pattern to search
// * @param start the index, the first byte is at position 1
// * @return the position (first byte is at position 1), or -1 for not found
// try {
// try {
// debugCode("position(blobPattern, "+start+");");
// debugCode("position(blobPattern, "+start+");");
// if(blobPattern == null) {
// if(blobPattern == null) {
...
@@ -224,7 +229,7 @@ public class JdbcBlob extends TraceObject implements Blob {
...
@@ -224,7 +229,7 @@ public class JdbcBlob extends TraceObject implements Blob {
// }
// }
// return position(out.toByteArray(), start);
// return position(out.toByteArray(), start);
// } catch(Throwable e) {
// } catch(Throwable e) {
// throw
Message.c
onvert(e);
// throw
logAndC
onvert(e);
// }
// }
}
}
...
...
h2/src/main/org/h2/jdbc/JdbcClob.java
浏览文件 @
4461f5e6
...
@@ -79,7 +79,7 @@ public class JdbcClob extends TraceObject implements Clob
...
@@ -79,7 +79,7 @@ public class JdbcClob extends TraceObject implements Clob
in
.
close
();
in
.
close
();
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
c
onvert
(
e
);
throw
logAndC
onvert
(
e
);
}
}
}
}
...
@@ -155,7 +155,7 @@ public class JdbcClob extends TraceObject implements Clob
...
@@ -155,7 +155,7 @@ public class JdbcClob extends TraceObject implements Clob
if
(
length
<
0
)
{
if
(
length
<
0
)
{
throw
Message
.
getInvalidValueException
(
"length"
,
""
+
length
);
throw
Message
.
getInvalidValueException
(
"length"
,
""
+
length
);
}
}
StringBuffer
buff
=
new
StringBuffer
(
length
);
StringBuffer
buff
=
new
StringBuffer
(
Math
.
min
(
4096
,
length
)
);
Reader
reader
=
value
.
getReader
();
Reader
reader
=
value
.
getReader
();
try
{
try
{
IOUtils
.
skipFully
(
reader
,
pos
-
1
);
IOUtils
.
skipFully
(
reader
,
pos
-
1
);
...
@@ -229,7 +229,7 @@ public class JdbcClob extends TraceObject implements Clob
...
@@ -229,7 +229,7 @@ public class JdbcClob extends TraceObject implements Clob
throw
Message
.
getSQLException
(
ErrorCode
.
OBJECT_CLOSED
);
throw
Message
.
getSQLException
(
ErrorCode
.
OBJECT_CLOSED
);
}
}
}
}
/**
/**
* INTERNAL
* INTERNAL
*/
*/
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
4461f5e6
...
@@ -2065,6 +2065,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2065,6 +2065,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
if
(
debug
())
{
debugCode
(
"updateBlob("
+
columnIndex
+
", x, "
+
length
+
"L);"
);
debugCode
(
"updateBlob("
+
columnIndex
+
", x, "
+
length
+
"L);"
);
}
}
checkClosed
();
Value
v
=
conn
.
createBlob
(
x
,
length
);
Value
v
=
conn
.
createBlob
(
x
,
length
);
update
(
columnIndex
,
v
);
update
(
columnIndex
,
v
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
@@ -2084,6 +2085,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2084,6 +2085,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
if
(
debug
())
{
debugCode
(
"updateBlob("
+
columnIndex
+
", x);"
);
debugCode
(
"updateBlob("
+
columnIndex
+
", x);"
);
}
}
checkClosed
();
Value
v
;
Value
v
;
if
(
x
==
null
)
{
if
(
x
==
null
)
{
v
=
ValueNull
.
INSTANCE
;
v
=
ValueNull
.
INSTANCE
;
...
@@ -2108,6 +2110,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2108,6 +2110,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
if
(
debug
())
{
debugCode
(
"updateBlob("
+
quote
(
columnName
)+
", x);"
);
debugCode
(
"updateBlob("
+
quote
(
columnName
)+
", x);"
);
}
}
checkClosed
();
Value
v
;
Value
v
;
if
(
x
==
null
)
{
if
(
x
==
null
)
{
v
=
ValueNull
.
INSTANCE
;
v
=
ValueNull
.
INSTANCE
;
...
@@ -2144,6 +2147,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2144,6 +2147,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
if
(
debug
())
{
debugCode
(
"updateBlob("
+
quote
(
columnName
)+
", x, "
+
length
+
"L);"
);
debugCode
(
"updateBlob("
+
quote
(
columnName
)+
", x, "
+
length
+
"L);"
);
}
}
checkClosed
();
Value
v
=
conn
.
createBlob
(
x
,
-
1
);
Value
v
=
conn
.
createBlob
(
x
,
-
1
);
update
(
columnName
,
v
);
update
(
columnName
,
v
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
@@ -3014,6 +3018,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -3014,6 +3018,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
public
int
getHoldability
()
throws
SQLException
{
public
int
getHoldability
()
throws
SQLException
{
try
{
try
{
debugCodeCall
(
"getHoldability"
);
debugCodeCall
(
"getHoldability"
);
checkClosed
();
return
conn
.
getHoldability
();
return
conn
.
getHoldability
();
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -3367,6 +3372,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -3367,6 +3372,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
if
(
debug
())
{
debugCode
(
"updateNCharacterStream("
+
columnIndex
+
", x, "
+
length
+
"L);"
);
debugCode
(
"updateNCharacterStream("
+
columnIndex
+
", x, "
+
length
+
"L);"
);
}
}
checkClosed
();
Value
v
=
conn
.
createClob
(
x
,
length
);
Value
v
=
conn
.
createClob
(
x
,
length
);
update
(
columnIndex
,
v
);
update
(
columnIndex
,
v
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
@@ -3410,6 +3416,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -3410,6 +3416,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
if
(
debug
())
{
debugCode
(
"updateNCharacterStream("
+
quote
(
columnName
)+
", x, "
+
length
+
"L);"
);
debugCode
(
"updateNCharacterStream("
+
quote
(
columnName
)+
", x, "
+
length
+
"L);"
);
}
}
checkClosed
();
Value
v
=
conn
.
createClob
(
x
,
length
);
Value
v
=
conn
.
createClob
(
x
,
length
);
update
(
columnName
,
v
);
update
(
columnName
,
v
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
...
h2/src/main/org/h2/store/fs/FileSystemDisk.java
浏览文件 @
4461f5e6
...
@@ -150,7 +150,13 @@ public class FileSystemDisk extends FileSystem {
...
@@ -150,7 +150,13 @@ public class FileSystemDisk extends FileSystem {
}
}
File
f
=
File
.
createTempFile
(
prefix
,
suffix
,
dir
);
File
f
=
File
.
createTempFile
(
prefix
,
suffix
,
dir
);
if
(
deleteOnExit
)
{
if
(
deleteOnExit
)
{
f
.
deleteOnExit
();
try
{
f
.
deleteOnExit
();
}
catch
(
Throwable
e
)
{
// sometimes this throws a NullPointerException
// at java.io.DeleteOnExitHook.add(DeleteOnExitHook.java:33)
// we can ignore it
}
}
}
return
f
.
getCanonicalPath
();
return
f
.
getCanonicalPath
();
}
}
...
...
h2/src/main/org/h2/util/IOUtils.java
浏览文件 @
4461f5e6
...
@@ -7,6 +7,7 @@ package org.h2.util;
...
@@ -7,6 +7,7 @@ package org.h2.util;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.EOFException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
...
@@ -42,13 +43,21 @@ public class IOUtils {
...
@@ -42,13 +43,21 @@ public class IOUtils {
public
static
void
skipFully
(
InputStream
in
,
long
skip
)
throws
IOException
{
public
static
void
skipFully
(
InputStream
in
,
long
skip
)
throws
IOException
{
while
(
skip
>
0
)
{
while
(
skip
>
0
)
{
skip
-=
in
.
skip
(
skip
);
long
skipped
=
in
.
skip
(
skip
);
if
(
skipped
<=
0
)
{
throw
new
EOFException
();
}
skip
-=
skipped
;
}
}
}
}
public
static
void
skipFully
(
Reader
reader
,
long
skip
)
throws
IOException
{
public
static
void
skipFully
(
Reader
reader
,
long
skip
)
throws
IOException
{
while
(
skip
>
0
)
{
while
(
skip
>
0
)
{
skip
-=
reader
.
skip
(
skip
);
long
skipped
=
reader
.
skip
(
skip
);
if
(
skipped
<=
0
)
{
throw
new
EOFException
();
}
skip
-=
skipped
;
}
}
}
}
...
...
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
4461f5e6
...
@@ -67,6 +67,11 @@ public class TestCases extends TestBase {
...
@@ -67,6 +67,11 @@ public class TestCases extends TestBase {
deleteDb
(
"cases"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
try
{
stat
.
execute
(
"create table address(id identity, name varchar check? instr(value, '@') > 1)"
);
}
catch
(
SQLException
e
)
{
checkNotGeneralException
(
e
);
}
stat
.
execute
(
"SET AUTOCOMMIT OFF; \n//create sequence if not exists object_id;\n"
);
stat
.
execute
(
"SET AUTOCOMMIT OFF; \n//create sequence if not exists object_id;\n"
);
stat
.
execute
(
"SET AUTOCOMMIT OFF;\n//create sequence if not exists object_id;\n"
);
stat
.
execute
(
"SET AUTOCOMMIT OFF;\n//create sequence if not exists object_id;\n"
);
stat
.
execute
(
"SET AUTOCOMMIT OFF; //create sequence if not exists object_id;"
);
stat
.
execute
(
"SET AUTOCOMMIT OFF; //create sequence if not exists object_id;"
);
...
...
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
4461f5e6
...
@@ -252,6 +252,8 @@ public class TestCrashAPI extends TestBase {
...
@@ -252,6 +252,8 @@ public class TestCrashAPI extends TestBase {
private
void
printIfBad
(
int
seed
,
int
id
,
int
objectId
,
Throwable
t
)
{
private
void
printIfBad
(
int
seed
,
int
id
,
int
objectId
,
Throwable
t
)
{
if
(
t
instanceof
BatchUpdateException
)
{
if
(
t
instanceof
BatchUpdateException
)
{
// do nothing
// do nothing
}
else
if
(
t
.
getClass
().
getName
().
indexOf
(
"SQLClientInfoException"
)
>=
0
)
{
// do nothing
}
else
if
(
t
instanceof
SQLException
)
{
}
else
if
(
t
instanceof
SQLException
)
{
SQLException
s
=
(
SQLException
)
t
;
SQLException
s
=
(
SQLException
)
t
;
String
state
=
s
.
getSQLState
();
String
state
=
s
.
getSQLState
();
...
...
h2/src/test/org/h2/test/synth/sql/RandomGen.java
浏览文件 @
4461f5e6
...
@@ -168,15 +168,35 @@ public class RandomGen {
...
@@ -168,15 +168,35 @@ public class RandomGen {
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
getInt
(
10
)
+
2000
);
buff
.
append
(
getInt
(
10
)
+
2000
);
buff
.
append
(
'-'
);
buff
.
append
(
'-'
);
buff
.
append
(
getInt
(
12
)
+
1
);
int
month
=
getInt
(
12
)
+
1
;
if
(
month
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
month
);
buff
.
append
(
'-'
);
buff
.
append
(
'-'
);
buff
.
append
(
getInt
(
28
)
+
1
);
int
day
=
getInt
(
28
)
+
1
;
if
(
day
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
day
);
buff
.
append
(
' '
);
buff
.
append
(
' '
);
buff
.
append
(
getInt
(
24
));
int
hour
=
getInt
(
24
);
if
(
hour
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
hour
);
buff
.
append
(
':'
);
buff
.
append
(
':'
);
buff
.
append
(
getInt
(
60
));
int
minute
=
getInt
(
60
);
if
(
minute
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
minute
);
buff
.
append
(
':'
);
buff
.
append
(
':'
);
buff
.
append
(
getInt
(
60
));
int
second
=
getInt
(
60
);
if
(
second
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
second
);
// TODO test timestamp nanos
// TODO test timestamp nanos
return
Timestamp
.
valueOf
(
buff
.
toString
());
return
Timestamp
.
valueOf
(
buff
.
toString
());
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论