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
benchmark.drivers.dir
=
C
\:
/data/java
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 {
read
();
if
(
indexed
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
INT
)
{
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
);
}
indexedParameterList
=
new
ObjectArray
();
...
...
h2/src/main/org/h2/jdbc/JdbcBlob.java
浏览文件 @
4461f5e6
...
...
@@ -66,7 +66,7 @@ public class JdbcBlob extends TraceObject implements Blob {
}
return
size
;
}
catch
(
Throwable
e
)
{
throw
Message
.
c
onvert
(
e
);
throw
logAndC
onvert
(
e
);
}
}
...
...
@@ -108,7 +108,7 @@ public class JdbcBlob extends TraceObject implements Blob {
}
return
out
.
toByteArray
();
}
catch
(
Throwable
e
)
{
throw
Message
.
c
onvert
(
e
);
throw
logAndC
onvert
(
e
);
}
}
...
...
@@ -134,8 +134,13 @@ public class JdbcBlob extends TraceObject implements Blob {
* @return the input stream
*/
public
InputStream
getBinaryStream
()
throws
SQLException
{
debugCodeCall
(
"getBinaryStream"
);
return
value
.
getInputStream
();
try
{
debugCodeCall
(
"getBinaryStream"
);
checkClosed
();
return
value
.
getInputStream
();
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
}
}
/**
...
...
@@ -148,15 +153,15 @@ public class JdbcBlob extends TraceObject implements Blob {
/**
* [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
{
debugCode
(
"position(pattern, "
+
start
+
");"
);
throw
Message
.
getUnsupportedException
();
// 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 {
// debugCode("position(pattern, "+start+");");
// if(pattern == null) {
...
...
@@ -193,21 +198,21 @@ public class JdbcBlob extends TraceObject implements Blob {
// }
// return -1;
// } catch(Throwable e) {
// throw
Message.c
onvert(e);
// throw
logAndC
onvert(e);
// }
}
/**
* [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
{
debugCode
(
"position(blobPattern, "
+
start
+
");"
);
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 {
// debugCode("position(blobPattern, "+start+");");
// if(blobPattern == null) {
...
...
@@ -224,7 +229,7 @@ public class JdbcBlob extends TraceObject implements Blob {
// }
// return position(out.toByteArray(), start);
// } 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
in
.
close
();
}
}
catch
(
Throwable
e
)
{
throw
Message
.
c
onvert
(
e
);
throw
logAndC
onvert
(
e
);
}
}
...
...
@@ -155,7 +155,7 @@ public class JdbcClob extends TraceObject implements Clob
if
(
length
<
0
)
{
throw
Message
.
getInvalidValueException
(
"length"
,
""
+
length
);
}
StringBuffer
buff
=
new
StringBuffer
(
length
);
StringBuffer
buff
=
new
StringBuffer
(
Math
.
min
(
4096
,
length
)
);
Reader
reader
=
value
.
getReader
();
try
{
IOUtils
.
skipFully
(
reader
,
pos
-
1
);
...
...
@@ -229,7 +229,7 @@ public class JdbcClob extends TraceObject implements Clob
throw
Message
.
getSQLException
(
ErrorCode
.
OBJECT_CLOSED
);
}
}
/**
* INTERNAL
*/
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
4461f5e6
...
...
@@ -2065,6 +2065,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
debugCode
(
"updateBlob("
+
columnIndex
+
", x, "
+
length
+
"L);"
);
}
checkClosed
();
Value
v
=
conn
.
createBlob
(
x
,
length
);
update
(
columnIndex
,
v
);
}
catch
(
Throwable
e
)
{
...
...
@@ -2084,6 +2085,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
debugCode
(
"updateBlob("
+
columnIndex
+
", x);"
);
}
checkClosed
();
Value
v
;
if
(
x
==
null
)
{
v
=
ValueNull
.
INSTANCE
;
...
...
@@ -2108,6 +2110,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
debugCode
(
"updateBlob("
+
quote
(
columnName
)+
", x);"
);
}
checkClosed
();
Value
v
;
if
(
x
==
null
)
{
v
=
ValueNull
.
INSTANCE
;
...
...
@@ -2144,6 +2147,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
debugCode
(
"updateBlob("
+
quote
(
columnName
)+
", x, "
+
length
+
"L);"
);
}
checkClosed
();
Value
v
=
conn
.
createBlob
(
x
,
-
1
);
update
(
columnName
,
v
);
}
catch
(
Throwable
e
)
{
...
...
@@ -3014,6 +3018,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
public
int
getHoldability
()
throws
SQLException
{
try
{
debugCodeCall
(
"getHoldability"
);
checkClosed
();
return
conn
.
getHoldability
();
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -3367,6 +3372,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
debugCode
(
"updateNCharacterStream("
+
columnIndex
+
", x, "
+
length
+
"L);"
);
}
checkClosed
();
Value
v
=
conn
.
createClob
(
x
,
length
);
update
(
columnIndex
,
v
);
}
catch
(
Throwable
e
)
{
...
...
@@ -3410,6 +3416,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
debug
())
{
debugCode
(
"updateNCharacterStream("
+
quote
(
columnName
)+
", x, "
+
length
+
"L);"
);
}
checkClosed
();
Value
v
=
conn
.
createClob
(
x
,
length
);
update
(
columnName
,
v
);
}
catch
(
Throwable
e
)
{
...
...
h2/src/main/org/h2/store/fs/FileSystemDisk.java
浏览文件 @
4461f5e6
...
...
@@ -150,7 +150,13 @@ public class FileSystemDisk extends FileSystem {
}
File
f
=
File
.
createTempFile
(
prefix
,
suffix
,
dir
);
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
();
}
...
...
h2/src/main/org/h2/util/IOUtils.java
浏览文件 @
4461f5e6
...
...
@@ -7,6 +7,7 @@ package org.h2.util;
import
java.io.BufferedReader
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.EOFException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
...
...
@@ -42,13 +43,21 @@ public class IOUtils {
public
static
void
skipFully
(
InputStream
in
,
long
skip
)
throws
IOException
{
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
{
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 {
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
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; //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 {
private
void
printIfBad
(
int
seed
,
int
id
,
int
objectId
,
Throwable
t
)
{
if
(
t
instanceof
BatchUpdateException
)
{
// do nothing
}
else
if
(
t
.
getClass
().
getName
().
indexOf
(
"SQLClientInfoException"
)
>=
0
)
{
// do nothing
}
else
if
(
t
instanceof
SQLException
)
{
SQLException
s
=
(
SQLException
)
t
;
String
state
=
s
.
getSQLState
();
...
...
h2/src/test/org/h2/test/synth/sql/RandomGen.java
浏览文件 @
4461f5e6
...
...
@@ -168,15 +168,35 @@ public class RandomGen {
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
getInt
(
10
)
+
2000
);
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
(
getInt
(
28
)
+
1
);
int
day
=
getInt
(
28
)
+
1
;
if
(
day
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
day
);
buff
.
append
(
' '
);
buff
.
append
(
getInt
(
24
));
int
hour
=
getInt
(
24
);
if
(
hour
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
hour
);
buff
.
append
(
':'
);
buff
.
append
(
getInt
(
60
));
int
minute
=
getInt
(
60
);
if
(
minute
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
minute
);
buff
.
append
(
':'
);
buff
.
append
(
getInt
(
60
));
int
second
=
getInt
(
60
);
if
(
second
<
10
)
{
buff
.
append
(
'0'
);
}
buff
.
append
(
second
);
// TODO test timestamp nanos
return
Timestamp
.
valueOf
(
buff
.
toString
());
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论