Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f188e9dc
提交
f188e9dc
authored
6月 13, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
9ac5a876
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
69 行增加
和
50 行删除
+69
-50
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+3
-2
Backup.java
h2/src/main/org/h2/tools/Backup.java
+5
-3
ChangePassword.java
h2/src/main/org/h2/tools/ChangePassword.java
+1
-1
CompressTool.java
h2/src/main/org/h2/tools/CompressTool.java
+2
-2
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-1
CreateCluster.java
h2/src/main/org/h2/tools/CreateCluster.java
+6
-6
Restore.java
h2/src/main/org/h2/tools/Restore.java
+1
-1
RunScript.java
h2/src/main/org/h2/tools/RunScript.java
+2
-4
Script.java
h2/src/main/org/h2/tools/Script.java
+3
-4
FileUtils.java
h2/src/main/org/h2/util/FileUtils.java
+17
-13
NetUtils.java
h2/src/main/org/h2/util/NetUtils.java
+1
-1
RandomUtils.java
h2/src/main/org/h2/util/RandomUtils.java
+2
-0
ScriptReader.java
h2/src/main/org/h2/util/ScriptReader.java
+1
-1
DataType.java
h2/src/main/org/h2/value/DataType.java
+1
-1
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+15
-10
ValueStringFixed.java
h2/src/main/org/h2/value/ValueStringFixed.java
+4
-0
SQLInjection.java
h2/src/test/org/h2/samples/SQLInjection.java
+4
-0
没有找到文件。
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
f188e9dc
...
@@ -726,8 +726,9 @@ public class MetaTable extends Table {
...
@@ -726,8 +726,9 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
HELP:
{
case
HELP:
{
String
resource
=
"/org/h2/res/help.csv"
;
try
{
try
{
byte
[]
data
=
Resources
.
get
(
"/org/h2/res/help.csv"
);
byte
[]
data
=
Resources
.
get
(
resource
);
Reader
reader
=
new
InputStreamReader
(
new
ByteArrayInputStream
(
data
));
Reader
reader
=
new
InputStreamReader
(
new
ByteArrayInputStream
(
data
));
ResultSet
rs
=
Csv
.
getInstance
().
read
(
reader
,
null
);
ResultSet
rs
=
Csv
.
getInstance
().
read
(
reader
,
null
);
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
...
@@ -741,7 +742,7 @@ public class MetaTable extends Table {
...
@@ -741,7 +742,7 @@ public class MetaTable extends Table {
});
});
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
resourc
e
);
}
}
break
;
break
;
}
}
...
...
h2/src/main/org/h2/tools/Backup.java
浏览文件 @
f188e9dc
...
@@ -80,8 +80,10 @@ public class Backup {
...
@@ -80,8 +80,10 @@ public class Backup {
*/
*/
public
static
void
execute
(
String
zipFileName
,
String
directory
,
String
db
,
boolean
quiet
)
throws
SQLException
{
public
static
void
execute
(
String
zipFileName
,
String
directory
,
String
db
,
boolean
quiet
)
throws
SQLException
{
ArrayList
list
=
FileLister
.
getDatabaseFiles
(
directory
,
db
,
true
);
ArrayList
list
=
FileLister
.
getDatabaseFiles
(
directory
,
db
,
true
);
if
(
list
.
size
()
==
0
&&
!
quiet
)
{
if
(
list
.
size
()
==
0
)
{
if
(!
quiet
)
{
System
.
out
.
println
(
"No database files found"
);
System
.
out
.
println
(
"No database files found"
);
}
return
;
return
;
}
}
File
file
=
new
File
(
zipFileName
);
File
file
=
new
File
(
zipFileName
);
...
@@ -111,7 +113,7 @@ public class Backup {
...
@@ -111,7 +113,7 @@ public class Backup {
zipOut
.
closeEntry
();
zipOut
.
closeEntry
();
zipOut
.
close
();
zipOut
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
zipFileNam
e
);
}
finally
{
}
finally
{
IOUtils
.
closeSilently
(
out
);
IOUtils
.
closeSilently
(
out
);
}
}
...
...
h2/src/main/org/h2/tools/ChangePassword.java
浏览文件 @
f188e9dc
...
@@ -177,7 +177,7 @@ public class ChangePassword {
...
@@ -177,7 +177,7 @@ public class ChangePassword {
in
.
close
();
in
.
close
();
out
.
close
();
out
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName
);
FileUtils
.
rename
(
temp
,
fileName
);
FileUtils
.
rename
(
temp
,
fileName
);
...
...
h2/src/main/org/h2/tools/CompressTool.java
浏览文件 @
f188e9dc
...
@@ -263,7 +263,7 @@ public class CompressTool {
...
@@ -263,7 +263,7 @@ public class CompressTool {
}
}
return
out
;
return
out
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
@@ -295,7 +295,7 @@ public class CompressTool {
...
@@ -295,7 +295,7 @@ public class CompressTool {
}
}
return
in
;
return
in
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
...
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
f188e9dc
...
@@ -61,7 +61,7 @@ public class ConvertTraceFile {
...
@@ -61,7 +61,7 @@ public class ConvertTraceFile {
try
{
try
{
convertFile
(
traceFile
,
javaClass
,
script
);
convertFile
(
traceFile
,
javaClass
,
script
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
traceFil
e
);
}
}
}
}
...
...
h2/src/main/org/h2/tools/CreateCluster.java
浏览文件 @
f188e9dc
...
@@ -9,7 +9,6 @@ import java.sql.Connection;
...
@@ -9,7 +9,6 @@ import java.sql.Connection;
import
java.sql.DriverManager
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
org.h2.message.Message
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
/**
/**
...
@@ -87,17 +86,20 @@ public class CreateCluster {
...
@@ -87,17 +86,20 @@ public class CreateCluster {
Statement
stat
=
null
;
Statement
stat
=
null
;
try
{
try
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
// use cluster='' so connecting is possible even if the cluster is enabled
// use cluster='' so connecting is possible even if the cluster is enabled
conn
=
DriverManager
.
getConnection
(
urlSource
+
";CLUSTER=''"
,
user
,
password
);
conn
=
DriverManager
.
getConnection
(
urlSource
+
";CLUSTER=''"
,
user
,
password
);
conn
.
close
();
conn
.
close
();
boolean
exists
;
try
{
try
{
conn
=
DriverManager
.
getConnection
(
urlTarget
+
";IFEXISTS=TRUE"
,
user
,
password
);
conn
=
DriverManager
.
getConnection
(
urlTarget
+
";IFEXISTS=TRUE"
,
user
,
password
);
conn
.
close
();
conn
.
close
();
throw
new
Exception
(
"Target database must not yet exist. Please delete it first"
)
;
exists
=
true
;
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
// database does not exists - ok
// database does not exists - ok
exists
=
false
;
}
if
(
exists
)
{
throw
new
SQLException
(
"Target database must not yet exist. Please delete it first"
);
}
}
// TODO cluster: need to open the database in exclusive mode, so that other applications
// TODO cluster: need to open the database in exclusive mode, so that other applications
...
@@ -116,8 +118,6 @@ public class CreateCluster {
...
@@ -116,8 +118,6 @@ public class CreateCluster {
conn
=
DriverManager
.
getConnection
(
urlTarget
,
user
,
password
);
conn
=
DriverManager
.
getConnection
(
urlTarget
,
user
,
password
);
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
stat
.
executeUpdate
(
"SET CLUSTER '"
+
serverlist
+
"'"
);
stat
.
executeUpdate
(
"SET CLUSTER '"
+
serverlist
+
"'"
);
}
catch
(
Exception
e
)
{
throw
Message
.
convert
(
e
);
}
finally
{
}
finally
{
JdbcUtils
.
closeSilently
(
conn
);
JdbcUtils
.
closeSilently
(
conn
);
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
stat
);
...
...
h2/src/main/org/h2/tools/Restore.java
浏览文件 @
f188e9dc
...
@@ -158,7 +158,7 @@ public class Restore {
...
@@ -158,7 +158,7 @@ public class Restore {
zipIn
.
closeEntry
();
zipIn
.
closeEntry
();
zipIn
.
close
();
zipIn
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
zipFileNam
e
);
}
finally
{
}
finally
{
IOUtils
.
closeSilently
(
in
);
IOUtils
.
closeSilently
(
in
);
}
}
...
...
h2/src/main/org/h2/tools/RunScript.java
浏览文件 @
f188e9dc
...
@@ -232,8 +232,6 @@ public class RunScript {
...
@@ -232,8 +232,6 @@ public class RunScript {
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
String
sql
=
"RUNSCRIPT FROM '"
+
fileName
+
"' "
+
options
;
String
sql
=
"RUNSCRIPT FROM '"
+
fileName
+
"' "
+
options
;
stat
.
execute
(
sql
);
stat
.
execute
(
sql
);
}
catch
(
Exception
e
)
{
throw
Message
.
convert
(
e
);
}
finally
{
}
finally
{
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
conn
);
JdbcUtils
.
closeSilently
(
conn
);
...
@@ -264,8 +262,8 @@ public class RunScript {
...
@@ -264,8 +262,8 @@ public class RunScript {
}
finally
{
}
finally
{
conn
.
close
();
conn
.
close
();
}
}
}
catch
(
Exception
e
)
{
}
catch
(
IO
Exception
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
fileNam
e
);
}
}
}
}
...
...
h2/src/main/org/h2/tools/Script.java
浏览文件 @
f188e9dc
...
@@ -6,6 +6,7 @@ package org.h2.tools;
...
@@ -6,6 +6,7 @@ package org.h2.tools;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.DriverManager
;
...
@@ -110,8 +111,6 @@ public class Script {
...
@@ -110,8 +111,6 @@ public class Script {
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
String
sql
=
"SCRIPT "
+
options1
+
" TO '"
+
fileName
+
"' "
+
options2
;
String
sql
=
"SCRIPT "
+
options1
+
" TO '"
+
fileName
+
"' "
+
options2
;
stat
.
execute
(
sql
);
stat
.
execute
(
sql
);
}
catch
(
Exception
e
)
{
throw
Message
.
convert
(
e
);
}
finally
{
}
finally
{
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
conn
);
JdbcUtils
.
closeSilently
(
conn
);
...
@@ -143,8 +142,8 @@ public class Script {
...
@@ -143,8 +142,8 @@ public class Script {
writer
.
println
(
s
+
";"
);
writer
.
println
(
s
+
";"
);
}
}
writer
.
close
();
writer
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
IO
Exception
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
fileNam
e
);
}
finally
{
}
finally
{
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
conn
);
JdbcUtils
.
closeSilently
(
conn
);
...
...
h2/src/main/org/h2/util/FileUtils.java
浏览文件 @
f188e9dc
...
@@ -94,11 +94,12 @@ public class FileUtils {
...
@@ -94,11 +94,12 @@ public class FileUtils {
}
}
private
static
void
freeMemoryAndFinalize
()
{
private
static
void
freeMemoryAndFinalize
()
{
long
mem
=
Runtime
.
getRuntime
().
freeMemory
();
Runtime
rt
=
Runtime
.
getRuntime
();
long
mem
=
rt
.
freeMemory
();
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
System
.
gc
();
rt
.
gc
();
long
now
=
Runtime
.
getRuntime
()
.
freeMemory
();
long
now
=
rt
.
freeMemory
();
Runtime
.
getRuntime
()
.
runFinalization
();
rt
.
runFinalization
();
if
(
now
==
mem
)
{
if
(
now
==
mem
)
{
break
;
break
;
}
}
...
@@ -124,7 +125,7 @@ public class FileUtils {
...
@@ -124,7 +125,7 @@ public class FileUtils {
if
(
newFile
.
exists
())
{
if
(
newFile
.
exists
())
{
throw
Message
.
getSQLException
(
Message
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
,
newName
},
null
);
throw
Message
.
getSQLException
(
Message
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
,
newName
},
null
);
}
}
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
for
(
int
i
=
0
;
i
<
Constants
.
MAX_FILE_RETRY
;
i
++)
{
boolean
ok
=
oldFile
.
renameTo
(
newFile
);
boolean
ok
=
oldFile
.
renameTo
(
newFile
);
if
(
ok
)
{
if
(
ok
)
{
return
;
return
;
...
@@ -175,7 +176,7 @@ public class FileUtils {
...
@@ -175,7 +176,7 @@ public class FileUtils {
return
;
return
;
}
}
File
dir
=
new
File
(
parent
);
File
dir
=
new
File
(
parent
);
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
for
(
int
i
=
0
;
i
<
Constants
.
MAX_FILE_RETRY
;
i
++)
{
if
(
dir
.
exists
()
||
dir
.
mkdirs
())
{
if
(
dir
.
exists
()
||
dir
.
mkdirs
())
{
return
;
return
;
}
}
...
@@ -195,7 +196,7 @@ public class FileUtils {
...
@@ -195,7 +196,7 @@ public class FileUtils {
return
true
;
return
true
;
}
}
File
file
=
new
File
(
fileName
);
File
file
=
new
File
(
fileName
);
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
for
(
int
i
=
0
;
i
<
Constants
.
MAX_FILE_RETRY
;
i
++)
{
try
{
try
{
return
file
.
createNewFile
();
return
file
.
createNewFile
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -216,7 +217,7 @@ public class FileUtils {
...
@@ -216,7 +217,7 @@ public class FileUtils {
}
}
File
file
=
new
File
(
fileName
);
File
file
=
new
File
(
fileName
);
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
for
(
int
i
=
0
;
i
<
Constants
.
MAX_FILE_RETRY
;
i
++)
{
boolean
ok
=
file
.
delete
();
boolean
ok
=
file
.
delete
();
if
(
ok
)
{
if
(
ok
)
{
return
;
return
;
...
@@ -233,7 +234,7 @@ public class FileUtils {
...
@@ -233,7 +234,7 @@ public class FileUtils {
}
}
try
{
try
{
// sleep at most 256 ms
// sleep at most 256 ms
long
sleep
=
(
long
)
i
*
(
long
)
i
;
long
sleep
=
Math
.
min
(
256
,
i
*
i
)
;
Thread
.
sleep
(
sleep
);
Thread
.
sleep
(
sleep
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
// ignore
// ignore
...
@@ -267,7 +268,7 @@ public class FileUtils {
...
@@ -267,7 +268,7 @@ public class FileUtils {
try
{
try
{
return
f
.
getCanonicalPath
();
return
f
.
getCanonicalPath
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
fileNam
e
);
}
}
}
}
...
@@ -350,7 +351,6 @@ public class FileUtils {
...
@@ -350,7 +351,6 @@ public class FileUtils {
}
}
public
static
String
[]
listFiles
(
String
path
)
throws
SQLException
{
public
static
String
[]
listFiles
(
String
path
)
throws
SQLException
{
//System.out.println("listFiles: " + path);
if
(
isInMemory
(
path
))
{
if
(
isInMemory
(
path
))
{
String
[]
list
=
new
String
[
memoryFiles
.
size
()];
String
[]
list
=
new
String
[
memoryFiles
.
size
()];
MemoryFile
[]
l
=
new
MemoryFile
[
memoryFiles
.
size
()];
MemoryFile
[]
l
=
new
MemoryFile
[
memoryFiles
.
size
()];
...
@@ -372,7 +372,7 @@ public class FileUtils {
...
@@ -372,7 +372,7 @@ public class FileUtils {
}
}
return
list
;
return
list
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
path
);
}
}
// try {
// try {
...
@@ -399,6 +399,9 @@ public class FileUtils {
...
@@ -399,6 +399,9 @@ public class FileUtils {
}
}
public
static
void
copy
(
String
original
,
String
copy
)
throws
SQLException
{
public
static
void
copy
(
String
original
,
String
copy
)
throws
SQLException
{
int
todoTestDidNotClose
;
//System.out.println("###COPY### " + original + " " + copy);
//new Error("").printStackTrace();
FileOutputStream
out
=
null
;
FileOutputStream
out
=
null
;
FileInputStream
in
=
null
;
FileInputStream
in
=
null
;
try
{
try
{
...
@@ -413,9 +416,10 @@ public class FileUtils {
...
@@ -413,9 +416,10 @@ public class FileUtils {
out
.
write
(
buffer
,
0
,
len
);
out
.
write
(
buffer
,
0
,
len
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convertIOException
(
e
,
"original: "
+
original
+
" copy: "
+
copy
);
}
finally
{
IOUtils
.
closeSilently
(
in
);
IOUtils
.
closeSilently
(
in
);
IOUtils
.
closeSilently
(
out
);
IOUtils
.
closeSilently
(
out
);
throw
Message
.
convert
(
e
);
}
}
}
}
...
...
h2/src/main/org/h2/util/NetUtils.java
浏览文件 @
f188e9dc
...
@@ -52,7 +52,7 @@ public class NetUtils {
...
@@ -52,7 +52,7 @@ public class NetUtils {
}
catch
(
BindException
be
)
{
}
catch
(
BindException
be
)
{
throw
Message
.
getSQLException
(
Message
.
EXCEPTION_OPENING_PORT_1
,
new
String
[]{
""
+
port
},
be
);
throw
Message
.
getSQLException
(
Message
.
EXCEPTION_OPENING_PORT_1
,
new
String
[]{
""
+
port
},
be
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
"port: "
+
port
+
" ssl: "
+
ssl
);
}
}
}
}
...
...
h2/src/main/org/h2/util/RandomUtils.java
浏览文件 @
f188e9dc
...
@@ -15,6 +15,8 @@ public class RandomUtils {
...
@@ -15,6 +15,8 @@ public class RandomUtils {
static
{
static
{
try
{
try
{
secureRandom
=
SecureRandom
.
getInstance
(
"SHA1PRNG"
);
secureRandom
=
SecureRandom
.
getInstance
(
"SHA1PRNG"
);
byte
[]
seed
=
secureRandom
.
generateSeed
(
64
);
secureRandom
.
setSeed
(
seed
);
random
=
new
Random
(
secureRandom
.
nextLong
());
random
=
new
Random
(
secureRandom
.
nextLong
());
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
// random is null if the algorithm is not found
// random is null if the algorithm is not found
...
...
h2/src/main/org/h2/util/ScriptReader.java
浏览文件 @
f188e9dc
...
@@ -25,7 +25,7 @@ public class ScriptReader {
...
@@ -25,7 +25,7 @@ public class ScriptReader {
try
{
try
{
return
reader
.
read
();
return
reader
.
read
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
f188e9dc
...
@@ -613,7 +613,7 @@ public class DataType {
...
@@ -613,7 +613,7 @@ public class DataType {
}
else
if
(
x
instanceof
Timestamp
)
{
}
else
if
(
x
instanceof
Timestamp
)
{
return
ValueTimestamp
.
get
((
Timestamp
)
x
);
return
ValueTimestamp
.
get
((
Timestamp
)
x
);
}
else
if
(
x
instanceof
java
.
util
.
Date
)
{
}
else
if
(
x
instanceof
java
.
util
.
Date
)
{
return
Value
Date
.
get
(
new
Date
(((
java
.
util
.
Date
)
x
).
getTime
()));
return
Value
Timestamp
.
get
(
new
Timestamp
(((
java
.
util
.
Date
)
x
).
getTime
()));
}
else
if
(
x
instanceof
java
.
io
.
Reader
)
{
}
else
if
(
x
instanceof
java
.
io
.
Reader
)
{
return
ValueLob
.
createClob
((
java
.
io
.
Reader
)
x
,
-
1
,
session
.
getDataHandler
());
return
ValueLob
.
createClob
((
java
.
io
.
Reader
)
x
,
-
1
,
session
.
getDataHandler
());
}
else
if
(
x
instanceof
java
.
sql
.
Clob
)
{
}
else
if
(
x
instanceof
java
.
sql
.
Clob
)
{
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
f188e9dc
...
@@ -134,7 +134,7 @@ public class ValueLob extends Value {
...
@@ -134,7 +134,7 @@ public class ValueLob extends Value {
lob
.
createFromReader
(
buff
,
len
,
in
,
remaining
,
handler
);
lob
.
createFromReader
(
buff
,
len
,
in
,
remaining
,
handler
);
return
lob
;
return
lob
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
@@ -172,7 +172,7 @@ public class ValueLob extends Value {
...
@@ -172,7 +172,7 @@ public class ValueLob extends Value {
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
@@ -267,7 +267,7 @@ public class ValueLob extends Value {
...
@@ -267,7 +267,7 @@ public class ValueLob extends Value {
lob
.
createFromStream
(
buff
,
len
,
in
,
remaining
,
handler
);
lob
.
createFromStream
(
buff
,
len
,
in
,
remaining
,
handler
);
return
lob
;
return
lob
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
@@ -317,7 +317,7 @@ public class ValueLob extends Value {
...
@@ -317,7 +317,7 @@ public class ValueLob extends Value {
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
null
);
}
}
}
}
...
@@ -434,7 +434,7 @@ public class ValueLob extends Value {
...
@@ -434,7 +434,7 @@ public class ValueLob extends Value {
return
ByteUtils
.
convertBytesToString
(
buff
);
return
ByteUtils
.
convertBytesToString
(
buff
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
fileNam
e
);
}
}
}
}
...
@@ -450,18 +450,23 @@ public class ValueLob extends Value {
...
@@ -450,18 +450,23 @@ public class ValueLob extends Value {
try
{
try
{
return
IOUtils
.
readBytesAndClose
(
getInputStream
(),
Integer
.
MAX_VALUE
);
return
IOUtils
.
readBytesAndClose
(
getInputStream
(),
Integer
.
MAX_VALUE
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
IOException
(
e
,
fileNam
e
);
}
}
}
}
public
int
hashCode
()
{
public
int
hashCode
()
{
if
(
hash
==
0
)
{
if
(
hash
==
0
)
{
if
(
precision
>
4096
)
{
int
todoTestThis
;
return
(
int
)(
precision
^
(
precision
>>
32
));
}
else
{
try
{
try
{
hash
=
ByteUtils
.
getByteArrayHash
(
getBytes
());
hash
=
ByteUtils
.
getByteArrayHash
(
getBytes
());
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
// TODO hash code for lob: should not ignore exception
// TODO hash code for lob: should not ignore exception
}
}
}
}
}
return
hash
;
return
hash
;
}
}
...
...
h2/src/main/org/h2/value/ValueStringFixed.java
浏览文件 @
f188e9dc
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
value
;
package
org
.
h2
.
value
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
...
...
h2/src/test/org/h2/samples/SQLInjection.java
浏览文件 @
f188e9dc
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
samples
;
package
org
.
h2
.
samples
;
import
java.io.*
;
import
java.io.*
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论