Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f0bf7fad
提交
f0bf7fad
authored
1月 16, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
3ab5f276
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
37 个修改的文件
包含
1882 行增加
和
1272 行删除
+1882
-1272
ant-build.properties
h2/ant-build.properties
+1
-1
build.xml
h2/build.xml
+41
-47
features.html
h2/src/docsrc/html/features.html
+1
-0
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+353
-350
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+728
-350
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+351
-350
_messages_en.properties
h2/src/docsrc/textbase/_messages_en.properties
+1
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+16
-2
Set.java
h2/src/main/org/h2/command/dml/Set.java
+5
-0
SetTypes.java
h2/src/main/org/h2/command/dml/SetTypes.java
+2
-0
ErrorCode.java
h2/src/main/org/h2/constant/ErrorCode.java
+8
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+23
-0
Function.java
h2/src/main/org/h2/expression/Function.java
+19
-1
Variable.java
h2/src/main/org/h2/expression/Variable.java
+98
-0
JdbcBlob.java
h2/src/main/org/h2/jdbc/JdbcBlob.java
+3
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+4
-0
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+10
-0
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+10
-0
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+52
-42
UndoLog.java
h2/src/main/org/h2/log/UndoLog.java
+7
-3
_messages_de.properties
h2/src/main/org/h2/res/_messages_de.properties
+1
-0
_messages_en.properties
h2/src/main/org/h2/res/_messages_en.properties
+1
-0
_messages_ja.properties
h2/src/main/org/h2/res/_messages_ja.properties
+1
-0
_messages_pl.properties
h2/src/main/org/h2/res/_messages_pl.properties
+1
-0
_messages_pt_br.properties
h2/src/main/org/h2/res/_messages_pt_br.properties
+1
-0
TcpServer.java
h2/src/main/org/h2/server/TcpServer.java
+2
-2
FtpServer.java
h2/src/main/org/h2/server/ftp/FtpServer.java
+1
-1
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+1
-1
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+1
-1
_text_uk.properties
h2/src/main/org/h2/server/web/res/_text_uk.properties
+105
-105
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+1
-0
SimpleResultSet.java
h2/src/main/org/h2/tools/SimpleResultSet.java
+5
-3
NetUtils.java
h2/src/main/org/h2/util/NetUtils.java
+16
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+5
-9
test.in.txt
h2/src/test/org/h2/test/test.in.txt
+3
-0
testSimple.in.txt
h2/src/test/org/h2/test/testSimple.in.txt
+3
-0
dictionary.txt
h2/src/tools/org/h2/tools/doc/dictionary.txt
+1
-1
没有找到文件。
h2/ant-build.properties
浏览文件 @
f0bf7fad
#
Thu Jan 10 23:24:36
CET 2008
#
Wed Jan 16 10:26:35
CET 2008
javac
=
javac
benchmark.drivers.dir
=
C
\:
/data/java
path.servlet.jar
=
C
\:
/data/classpath/servlet-api.jar
...
...
h2/build.xml
浏览文件 @
f0bf7fad
...
...
@@ -59,46 +59,47 @@
</target>
<target
name=
"codeswitchJdk13"
depends=
"codeswitchPrepare"
>
<propertyfile
file=
"ant-build.properties"
>
<entry
key=
"jdk"
value=
"1.3"
/>
</propertyfile>
<java
classname=
"org.h2.tools.code.CodeSwitch"
classpath=
"bin"
>
<arg
line=
"+JDK13 -JDK14 -JDK16 +AWT src/main/org/h2"
/>
</java>
</target>
<target
name=
"codeswitchJdk14"
depends=
"codeswitchPrepare"
>
<propertyfile
file=
"ant-build.properties"
>
<entry
key=
"jdk"
value=
"1.
4
"
/>
<entry
key=
"jdk"
value=
"1.
3
"
/>
</propertyfile>
<property
name=
"jdk"
value=
"1.3"
/>
</target>
<target
name=
"codeswitchJdk14"
depends=
"codeswitchPrepare"
if=
"codeswitch.14"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
classpath=
"bin"
>
<arg
line=
"-JDK13 +JDK14 -JDK16 +AWT src/main/org/h2"
/>
</java>
</target>
<target
name=
"codeswitchJdk16"
depends=
"codeswitchPrepare"
>
<propertyfile
file=
"ant-build.properties"
>
<entry
key=
"jdk"
value=
"1.
6
"
/>
<entry
key=
"jdk"
value=
"1.
4
"
/>
</propertyfile>
</target>
<target
name=
"codeswitchJdk16"
depends=
"codeswitchPrepare"
if=
"codeswitch.16"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
classpath=
"bin"
>
<arg
line=
"-JDK13 +JDK14 +JDK16 +AWT src/main/org/h2"
/>
</java>
<propertyfile
file=
"ant-build.properties"
>
<entry
key=
"jdk"
value=
"1.6"
/>
</propertyfile>
</target>
<target
name=
"compileResources"
depends=
"clean, co
mpileTest
"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/Resources.java"
/>
<target
name=
"compileResources"
depends=
"clean, co
deswitchJdk14, codeswitchJdk16
"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/Resources.java"
/>
<java
classname=
"org.h2.util.Resources"
classpath=
"bin"
/>
<delete>
<fileset
dir=
"bin"
includes=
"org/h2/util/ResourceData.class"
/>
</delete>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/ResourceData.java"
/>
<javac
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/ResourceData.java"
/>
<delete>
<fileset
dir=
"bin"
includes=
"org/h2/util/ResourceData.java"
/>
</delete>
</target>
<target
name=
"compileFullTextLucene"
depends=
"compileFullTextLuceneTest, compile"
if=
"lucene.jar.present"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<classpath
location=
"${path.lucene.jar}"
/>
<include
name=
"org/h2/fulltext/FullTextLucene.java"
/>
</javac>
...
...
@@ -110,7 +111,7 @@
</target>
<target
name=
"compileServlet"
depends=
"compileServletTest, compile"
if=
"servlet.jar.present"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<classpath
location=
"${path.servlet.jar}"
/>
<include
name=
"org/h2/server/web/WebServlet.java"
/>
<include
name=
"org/h2/server/web/DbStarter.java"
/>
...
...
@@ -122,8 +123,9 @@
<echo
message=
"Please set ant-build.properties / path.servlet.jar"
/>
</target>
<target
name=
"compile"
depends=
"compileResources, compileTest"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
destdir=
"bin"
debug=
"true"
>
<target
name=
"compile"
depends=
"compileResources"
>
<echo
message=
"build-jdk:${java.specification.version} ant-build.properties/jdk:${jdk}"
></echo>
<javac
executable=
"${javac}"
destdir=
"bin"
debug=
"true"
>
<src
path=
"src/main"
/>
<src
path=
"src/test"
/>
<src
path=
"src/tools"
/>
...
...
@@ -148,14 +150,9 @@
<java
classname=
"org.h2.test.coverage.Coverage"
classpath=
"."
dir=
"bin"
fork=
"true"
>
<arg
line=
"-r org/h2"
/>
</java>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/**"
/>
<javac
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/**"
/>
</target>
<target
name=
"compileTest"
unless=
"java.version.ok"
>
<echo
message=
"WARNING: Java version is ${java.specification.version}, but source code is switched to ${jdk}."
/>
<echo
message=
"WARNING: Run ant codeswitchJdk... first."
/>
</target>
<target
name=
"docs"
depends=
"clean,javadoc,compile"
>
<copy
todir=
"docs"
>
<fileset
dir=
"src/docsrc"
includes=
"index.html"
/>
...
...
@@ -181,23 +178,20 @@
<target
name=
"init"
>
<available
file=
"${path.servlet.jar}"
property=
"servlet.jar.present"
/>
<available
file=
"${path.lucene.jar}"
property=
"lucene.jar.present"
/>
<condition
property=
"java.version.ok"
>
<or>
<and>
<equals
arg1=
"${java.specification.version}"
arg2=
"1.6"
/>
<equals
arg1=
"${jdk}"
arg2=
"1.6"
/>
</and>
<and>
<equals
arg1=
"${java.specification.version}"
arg2=
"1.5"
/>
<equals
arg1=
"${jdk}"
arg2=
"1.4"
/>
</and>
<and>
<equals
arg1=
"${java.specification.version}"
arg2=
"1.4"
/>
<equals
arg1=
"${jdk}"
arg2=
"1.4"
/>
</and>
</or>
</condition>
<echo
message=
"build-jdk:${java.specification.version} ant-build.properties/jdk:${jdk}"
></echo>
<condition
property=
"codeswitch.14"
>
<and>
<equals
arg1=
"${java.specification.version}"
arg2=
"1.4"
/>
<equals
arg1=
"${jdk}"
arg2=
"1.6"
/>
</and>
</condition>
<condition
property=
"codeswitch.16"
>
<and>
<equals
arg1=
"${java.specification.version}"
arg2=
"1.6"
/>
<not>
<equals
arg1=
"${jdk}"
arg2=
"1.6"
/>
</not>
</and>
</condition>
</target>
<target
name=
"jar"
depends=
"compile, compileServlet, compileFullTextLucene, manifest"
>
...
...
@@ -218,7 +212,7 @@
</target>
<target
name=
"jarClient"
depends=
"compileResources, manifest"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<include
name=
"org/h2/*"
/>
<include
name=
"org/h2/jdbc/**"
/>
<include
name=
"org/h2/jdbcx/**"
/>
...
...
@@ -230,7 +224,7 @@
</target>
<target
name=
"jarDb"
depends=
"compileResources, manifest"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<include
name=
"org/h2/*"
/>
<include
name=
"org/h2/engine/**"
/>
<include
name=
"org/h2/jdbc/**"
/>
...
...
@@ -243,9 +237,9 @@
</target>
<target
name=
"javadoc"
>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/StringUtils.java"
/>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/test"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/test/bnf/*.java"
/>
<javac
target=
"${jdk}"
source=
"${jdk}"
executable=
"${javac}"
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/tools/doclet/*.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/StringUtils.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/test"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/test/bnf/*.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/tools/doclet/*.java"
/>
<mkdir
dir=
"docs/javadoc"
/>
<javadoc
sourcepath=
"src/main"
...
...
@@ -285,7 +279,7 @@
<attribute
name=
"Implementation-Title"
value=
"H2 Database Engine"
/>
<attribute
name=
"Implementation-URL"
value=
"http://www.h2database.com"
/>
<attribute
name=
"Implementation-Version"
value=
"${version.name.maven}"
/>
<attribute
name=
"Build-Jdk"
value=
"${j
dk
}"
/>
<attribute
name=
"Build-Jdk"
value=
"${j
ava.specification.version
}"
/>
</manifest>
</target>
...
...
h2/src/docsrc/html/features.html
浏览文件 @
f0bf7fad
...
...
@@ -132,6 +132,7 @@ Features
</li><li>
Web-based Console application (English, German, partially French and Spanish) with autocomplete
</li><li>
The database can generate SQL script files
</li><li>
Contains a recovery tool that can dump the contents of the data file
</li><li>
Support for variables (for example to calculate running totals)
</li><li>
Automatic re-compilation of prepared statements
</li><li>
Uses a small number of database files, binary and text storage formats, graceful handling of low disk space situations
</li><li>
Uses a checksum for each record and log entry for data integrity
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
f0bf7fad
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
f0bf7fad
This source diff could not be displayed because it is too large. You can
view the blob
instead.
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
f0bf7fad
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_messages_en.properties
浏览文件 @
f0bf7fad
...
...
@@ -157,6 +157,7 @@
90134
=
Access to the class {0} is denied
90135
=
The database is open in exclusive mode; can not open additional connections
90136
=
Unsupported outer join condition
\:
{0}
90137
=
Can only assign to a variable, not to
\:
{0}
HY000
=
General error
\:
{0}
HY004
=
Unknown data type
\:
{0}
HYC00
=
Feature not supported
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
f0bf7fad
...
...
@@ -107,6 +107,7 @@ import org.h2.expression.Rownum;
import
org.h2.expression.SequenceValue
;
import
org.h2.expression.Subquery
;
import
org.h2.expression.ValueExpression
;
import
org.h2.expression.Variable
;
import
org.h2.expression.Wildcard
;
import
org.h2.index.Index
;
import
org.h2.message.Message
;
...
...
@@ -151,7 +152,7 @@ public class Parser {
// this are token types
private
static
final
int
KEYWORD
=
1
,
IDENTIFIER
=
2
,
PARAMETER
=
3
,
END
=
4
,
VALUE
=
5
;
private
static
final
int
EQUAL
=
6
,
BIGGER_EQUAL
=
7
,
BIGGER
=
8
;
private
static
final
int
SMALLER
=
9
,
SMALLER_EQUAL
=
10
,
NOT_EQUAL
=
11
;
private
static
final
int
SMALLER
=
9
,
SMALLER_EQUAL
=
10
,
NOT_EQUAL
=
11
,
AT
=
12
;
private
static
final
int
MINUS
=
17
,
PLUS
=
18
;
private
static
final
int
STRING_CONCAT
=
22
;
private
static
final
int
OPEN
=
31
,
CLOSE
=
32
,
NULL
=
34
,
TRUE
=
40
,
FALSE
=
41
;
...
...
@@ -1986,6 +1987,10 @@ public class Parser {
private
Expression
readTerm
()
throws
SQLException
{
Expression
r
;
switch
(
currentTokenType
)
{
case
AT:
read
();
r
=
new
Variable
(
session
,
readAliasIdentifier
());
break
;
case
PARAMETER:
// there must be no space between ? and the number
boolean
indexed
=
Character
.
isDigit
(
sqlCommandChars
[
parseIndex
]);
...
...
@@ -2674,6 +2679,7 @@ public class Parser {
case
'+'
:
case
'%'
:
case
'?'
:
case
'@'
:
case
'$'
:
case
']'
:
type
=
CHAR_SPECIAL_1
;
...
...
@@ -2782,6 +2788,8 @@ public class Parser {
case
'?'
:
case
'$'
:
return
PARAMETER
;
case
'@'
:
return
AT
;
case
'+'
:
return
PLUS
;
case
'-'
:
...
...
@@ -3677,7 +3685,13 @@ public class Parser {
}
private
Prepared
parseSet
()
throws
SQLException
{
if
(
readIf
(
"AUTOCOMMIT"
))
{
if
(
readIf
(
"@"
))
{
Set
command
=
new
Set
(
session
,
SetTypes
.
VARIABLE
);
command
.
setString
(
readAliasIdentifier
());
readIfEqualOrTo
();
command
.
setExpression
(
readExpression
());
return
command
;
}
else
if
(
readIf
(
"AUTOCOMMIT"
))
{
readIfEqualOrTo
();
boolean
value
=
readBooleanSetting
();
int
setting
=
value
?
TransactionCommand
.
AUTOCOMMIT_TRUE
:
TransactionCommand
.
AUTOCOMMIT_FALSE
;
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
f0bf7fad
...
...
@@ -290,6 +290,11 @@ public class Set extends Prepared {
}
break
;
}
case
SetTypes
.
VARIABLE
:
{
Expression
expr
=
expression
.
optimize
(
session
);
session
.
setVariable
(
stringValue
,
expr
.
getValue
(
session
));
break
;
}
default
:
throw
Message
.
getInternalError
(
"type="
+
type
);
}
...
...
h2/src/main/org/h2/command/dml/SetTypes.java
浏览文件 @
f0bf7fad
...
...
@@ -22,6 +22,7 @@ public class SetTypes {
public
static
final
int
OPTIMIZE_REUSE_RESULTS
=
27
,
SCHEMA_SEARCH_PATH
=
28
,
UNDO_LOG
=
29
;
public
static
final
int
REFERENTIAL_INTEGRITY
=
30
,
MVCC
=
31
,
MAX_OPERATION_MEMORY
=
32
,
EXCLUSIVE
=
33
;
public
static
final
int
CREATE_BUILD
=
34
;
public
static
final
int
VARIABLE
=
35
;
private
static
ObjectArray
types
=
new
ObjectArray
();
...
...
@@ -60,6 +61,7 @@ public class SetTypes {
setType
(
MAX_OPERATION_MEMORY
,
"MAX_OPERATION_MEMORY"
);
setType
(
EXCLUSIVE
,
"EXCLUSIVE"
);
setType
(
CREATE_BUILD
,
"CREATE_BUILD"
);
setType
(
VARIABLE
,
"@"
);
}
private
static
void
setType
(
int
type
,
String
name
)
{
...
...
h2/src/main/org/h2/constant/ErrorCode.java
浏览文件 @
f0bf7fad
...
...
@@ -318,6 +318,14 @@ public class ErrorCode {
public
static
final
int
DATABASE_IS_IN_EXCLUSIVE_MODE
=
90135
;
public
static
final
int
UNSUPPORTED_OUTER_JOIN_CONDITION_1
=
90136
;
/**
* Can only assign to a variable.
* <pre>
* SELECT AMOUNT, SET(@V, IFNULL(@V, 0)+AMOUNT) FROM TEST;
* </pre>
*/
public
static
final
int
CAN_ONLY_ASSIGN_TO_VARIABLE_1
=
90137
;
/**
* INTERNAL
*/
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
f0bf7fad
...
...
@@ -34,6 +34,7 @@ import org.h2.util.ObjectArray;
import
org.h2.util.ObjectUtils
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLong
;
import
org.h2.value.ValueNull
;
/**
* A session represents a database connection. When using the server mode,
...
...
@@ -75,10 +76,32 @@ public class Session implements SessionInterface {
private
boolean
rollbackMode
;
private
long
sessionStart
=
System
.
currentTimeMillis
();
private
long
currentCommandStart
;
private
HashMap
variables
;
public
Session
()
{
}
private
void
initVariables
()
{
if
(
variables
==
null
)
{
variables
=
new
HashMap
();
}
}
public
void
setVariable
(
String
name
,
Value
value
)
{
initVariables
();
if
(
value
==
ValueNull
.
INSTANCE
)
{
variables
.
remove
(
name
);
}
else
{
variables
.
put
(
name
,
value
);
}
}
public
Value
getVariable
(
String
name
)
{
initVariables
();
Value
v
=
(
Value
)
variables
.
get
(
name
);
return
v
==
null
?
ValueNull
.
INSTANCE
:
v
;
}
public
Table
findLocalTempTable
(
String
name
)
{
Table
t
=
null
;
if
(
localTempTables
!=
null
)
{
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
f0bf7fad
...
...
@@ -86,7 +86,7 @@ public class Function extends Expression implements FunctionCall {
public
static
final
int
IFNULL
=
200
,
CASEWHEN
=
201
,
CONVERT
=
202
,
CAST
=
203
,
COALESCE
=
204
,
NULLIF
=
205
,
CASE
=
206
,
NEXTVAL
=
207
,
CURRVAL
=
208
,
ARRAY_GET
=
209
,
CSVREAD
=
210
,
CSVWRITE
=
211
,
MEMORY_FREE
=
212
,
MEMORY_USED
=
213
,
LOCK_MODE
=
214
,
SCHEMA
=
215
,
SESSION_ID
=
216
,
ARRAY_LENGTH
=
217
,
LINK_SCHEMA
=
218
,
TABLE
=
219
,
LEAST
=
220
,
GREATEST
=
221
,
TABLE_DISTINCT
=
222
,
CANCEL_SESSION
=
223
;
LINK_SCHEMA
=
218
,
TABLE
=
219
,
LEAST
=
220
,
GREATEST
=
221
,
TABLE_DISTINCT
=
222
,
CANCEL_SESSION
=
223
,
SET
=
224
;
private
static
final
int
VAR_ARGS
=
-
1
;
...
...
@@ -289,6 +289,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull
(
"LEAST"
,
LEAST
,
VAR_ARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"GREATEST"
,
GREATEST
,
VAR_ARGS
,
Value
.
NULL
);
addFunction
(
"CANCEL_SESSION"
,
CANCEL_SESSION
,
1
,
Value
.
BOOLEAN
);
addFunction
(
"SET"
,
SET
,
2
,
Value
.
NULL
,
false
,
false
);
}
private
static
void
addFunction
(
String
name
,
int
type
,
int
parameterCount
,
int
dataType
,
...
...
@@ -1007,6 +1008,12 @@ public class Function extends Expression implements FunctionCall {
result
=
ValueInt
.
get
(
rows
);
break
;
}
case
SET:
{
Variable
var
=
(
Variable
)
args
[
0
];
session
.
setVariable
(
var
.
getName
(),
v1
);
result
=
v1
;
break
;
}
default
:
throw
Message
.
getInternalError
(
"type="
+
info
.
type
);
}
...
...
@@ -1576,6 +1583,17 @@ public class Function extends Expression implements FunctionCall {
scale
=
0
;
}
break
;
case
SET:
{
Expression
p1
=
args
[
1
];
dataType
=
p1
.
getType
();
precision
=
p1
.
getPrecision
();
scale
=
p1
.
getScale
();
displaySize
=
p1
.
getDisplaySize
();
if
(!(
p0
instanceof
Variable
))
{
throw
Message
.
getSQLException
(
ErrorCode
.
CAN_ONLY_ASSIGN_TO_VARIABLE_1
,
p0
.
getSQL
());
}
break
;
}
default
:
dataType
=
info
.
dataType
;
precision
=
0
;
...
...
h2/src/main/org/h2/expression/Variable.java
0 → 100644
浏览文件 @
f0bf7fad
/*
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
expression
;
import
java.sql.SQLException
;
import
org.h2.command.Parser
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.TableFilter
;
import
org.h2.value.Value
;
/**
* A user defined variable, for example: @ID.
*/
public
class
Variable
extends
Expression
{
private
final
String
name
;
private
Value
lastValue
;
public
Variable
(
Session
session
,
String
name
)
{
this
.
name
=
name
;
lastValue
=
session
.
getVariable
(
name
);
}
public
int
getCost
()
{
return
0
;
}
public
int
getDisplaySize
()
{
return
lastValue
.
getDisplaySize
();
}
public
long
getPrecision
()
{
return
lastValue
.
getPrecision
();
}
public
String
getSQL
()
{
return
"@"
+
Parser
.
quoteIdentifier
(
name
);
}
public
int
getScale
()
{
return
lastValue
.
getScale
();
}
public
int
getType
()
{
return
lastValue
.
getType
();
}
public
Value
getValue
(
Session
session
)
throws
SQLException
{
lastValue
=
session
.
getVariable
(
name
);
return
lastValue
;
}
public
boolean
isEverything
(
ExpressionVisitor
visitor
)
{
switch
(
visitor
.
type
)
{
case
ExpressionVisitor
.
OPTIMIZABLE_MIN_MAX_COUNT_ALL
:
return
true
;
case
ExpressionVisitor
.
DETERMINISTIC
:
return
false
;
case
ExpressionVisitor
.
READONLY
:
return
true
;
case
ExpressionVisitor
.
INDEPENDENT
:
return
true
;
case
ExpressionVisitor
.
EVALUATABLE
:
// the value will be evaluated at execute time
return
true
;
case
ExpressionVisitor
.
SET_MAX_DATA_MODIFICATION_ID
:
// it is checked independently if the value is the same as the last time
return
true
;
case
ExpressionVisitor
.
NOT_FROM_RESOLVER
:
return
true
;
default
:
throw
Message
.
getInternalError
(
"type="
+
visitor
.
type
);
}
}
public
void
mapColumns
(
ColumnResolver
resolver
,
int
level
)
throws
SQLException
{
}
public
Expression
optimize
(
Session
session
)
throws
SQLException
{
return
this
;
}
public
void
setEvaluatable
(
TableFilter
tableFilter
,
boolean
value
)
{
}
public
void
updateAggregate
(
Session
session
)
throws
SQLException
{
}
public
String
getName
()
{
return
name
;
}
}
h2/src/main/org/h2/jdbc/JdbcBlob.java
浏览文件 @
f0bf7fad
...
...
@@ -72,6 +72,8 @@ public class JdbcBlob extends TraceObject implements Blob {
/**
* [Not supported] Truncates the object.
*
* @param len the new length
*/
public
void
truncate
(
long
len
)
throws
SQLException
{
debugCodeCall
(
"truncate"
,
len
);
...
...
@@ -248,7 +250,7 @@ public class JdbcBlob extends TraceObject implements Blob {
throw
Message
.
getSQLException
(
ErrorCode
.
OBJECT_CLOSED
);
}
}
/**
* INTERNAL
*/
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
f0bf7fad
...
...
@@ -1373,6 +1373,8 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
* [Not supported] Return an object of this class if possible.
*
* @param iface the class
*/
//#ifdef JDK16
/*
...
...
@@ -1384,6 +1386,8 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
* [Not supported] Checks if unwrap can return an object of this class.
*
* @param iface the class
*/
//#ifdef JDK16
/*
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
f0bf7fad
...
...
@@ -2953,6 +2953,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* [Not supported] Returns the value of the specified column as a row id.
*
* @param columnIndex (1,2,...)
*/
//#ifdef JDK16
/*
...
...
@@ -2964,6 +2966,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* [Not supported] Returns the value of the specified column as a row id.
*
* @param columnName the name of the column label
*/
//#ifdef JDK16
/*
...
...
@@ -2975,6 +2979,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* [Not supported] Updates a column in the current or insert row.
*
* @param columnIndex (1,2,...)
* @param x the value
*/
//#ifdef JDK16
/*
...
...
@@ -2986,6 +2993,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* [Not supported] Updates a column in the current or insert row.
*
* @param columnName the name of the column label
* @param x the value
*/
//#ifdef JDK16
/*
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
f0bf7fad
...
...
@@ -278,6 +278,11 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
}
//#endif
/**
* [Not supported] Return an object of this class if possible.
*
* @param iface the class
*/
//#ifdef JDK16
/*
public <T> T unwrap(Class<T> iface) throws SQLException {
...
...
@@ -286,6 +291,11 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
//#endif
/**
* [Not supported] Checks if unwrap can return an object of this class.
*
* @param iface the class
*/
//#ifdef JDK16
/*
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
f0bf7fad
...
...
@@ -32,16 +32,16 @@ import javax.sql.StatementEventListener;
//#endif
/**
* This class provides support for distributed transactions.
* This class provides support for distributed transactions.
* An application developer usually does not use this interface.
* It is used by the transaction manager internally.
*/
public
class
JdbcXAConnection
extends
TraceObject
public
class
JdbcXAConnection
extends
TraceObject
//#ifdef JDK14
implements
XAConnection
,
XAResource
,
JdbcConnectionListener
//#endif
{
//#ifdef JDK14
private
JdbcDataSourceFactory
factory
;
private
String
url
,
user
,
password
;
...
...
@@ -51,11 +51,11 @@ implements XAConnection, XAResource, JdbcConnectionListener
private
Xid
currentTransaction
;
private
int
currentTransactionId
;
private
static
int
nextTransactionId
;
static
{
org
.
h2
.
Driver
.
load
();
}
JdbcXAConnection
(
JdbcDataSourceFactory
factory
,
int
id
,
String
url
,
String
user
,
String
password
)
throws
SQLException
{
this
.
factory
=
factory
;
setTrace
(
factory
.
getTrace
(),
TraceObject
.
XA_DATA_SOURCE
,
id
);
...
...
@@ -63,13 +63,13 @@ implements XAConnection, XAResource, JdbcConnectionListener
this
.
user
=
user
;
this
.
password
=
password
;
connSentinel
=
openConnection
();
getConnection
();
getConnection
();
}
//#endif
/**
* Get the XAResource object.
*
*
* @return itself
*/
//#ifdef JDK14
...
...
@@ -95,11 +95,11 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
}
//#endif
/**
* Get a new connection.
* This method is usually called by the connection pool when there are no more connections in the pool.
*
*
* @return the connection
*/
//#ifdef JDK14
...
...
@@ -114,10 +114,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
return
conn
;
}
//#endif
/**
* Register a new listener for the connection.
*
*
* @param listener the event listener
*/
//#ifdef JDK14
...
...
@@ -129,10 +129,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
}
//#endif
/**
* Remove the event listener.
*
*
* @param listener the event listener
*/
//#ifdef JDK14
...
...
@@ -141,7 +141,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
listeners
.
remove
(
listener
);
}
//#endif
/**
* INTERNAL
*/
...
...
@@ -156,7 +156,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
close
();
}
//#endif
/**
* INTERNAL
*/
...
...
@@ -170,10 +170,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
}
//#endif
/**
* Get the transaction timeout.
*
*
* @return 0
*/
//#ifdef JDK14
...
...
@@ -185,7 +185,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
/**
* Set the transaction timeout.
*
*
* @param seconds ignored
* @return false
*/
...
...
@@ -195,10 +195,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
return
false
;
}
//#endif
/**
* Checks if this is the same XAResource.
*
*
* @param xares the other object
* @return true if this is the same object
*/
...
...
@@ -208,11 +208,11 @@ implements XAConnection, XAResource, JdbcConnectionListener
return
xares
==
this
;
}
//#endif
/**
* Get the list of prepared transaction branches.
* This method is called by the transaction manager during recovery.
*
*
* @param flag TMSTARTRSCAN, TMENDRSCAN, or TMNOFLAGS. If no other flags are set,
* TMNOFLAGS must be used.
* @return zero or more Xid objects
...
...
@@ -244,10 +244,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
}
//#endif
/**
* Prepare a transaction.
*
*
* @param xid the transaction id
*/
//#ifdef JDK14
...
...
@@ -268,15 +268,15 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
finally
{
JdbcUtils
.
closeSilently
(
stat
);
}
getTrace
().
debug
(
"return XA_OK"
);
getTrace
().
debug
(
"return XA_OK"
);
return
XA_OK
;
}
//#endif
/**
* Forget a transaction.
* This method does not have an effect for this database.
*
*
* @param xid the transaction id
*/
//#ifdef JDK14
...
...
@@ -284,10 +284,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
debugCode
(
"forget("
+
quoteXid
(
xid
)+
")"
);
}
//#endif
/**
* Roll back a transaction.
*
*
* @param xid the transaction id
*/
//#ifdef JDK14
...
...
@@ -299,13 +299,13 @@ implements XAConnection, XAResource, JdbcConnectionListener
throw
convertException
(
e
);
}
getTrace
().
debug
(
"rolled back"
);
currentTransaction
=
null
;
currentTransaction
=
null
;
}
//#endif
/**
* End a transaction.
*
*
* @param xid the transaction id
* @param flags TMSUCCESS, TMFAIL, or TMSUSPEND
*/
...
...
@@ -322,10 +322,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
}
//#endif
/**
* Start or continue to work on a transaction.
*
*
* @param xid the transaction id
* @param flags TMNOFLAGS, TMJOIN, or TMRESUME
*/
...
...
@@ -348,10 +348,10 @@ implements XAConnection, XAResource, JdbcConnectionListener
currentTransaction
=
xid
;
}
//#endif
/**
* Commit a transaction.
*
*
* @param xid the transaction id
* @param onePhase use a one-phase protocol if true
*/
...
...
@@ -372,10 +372,15 @@ implements XAConnection, XAResource, JdbcConnectionListener
JdbcUtils
.
closeSilently
(
stat
);
}
getTrace
().
debug
(
"committed"
);
currentTransaction
=
null
;
currentTransaction
=
null
;
}
//#endif
/**
* [Not supported] Add a statement event listener.
*
* @param listener the new statement event listener
*/
//#ifdef JDK16
/*
public void addStatementEventListener(StatementEventListener listener) {
...
...
@@ -384,6 +389,11 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#endif
/**
* [Not supported] Remove a statement event listener.
*
* @param listener the statement event listener
*/
//#ifdef JDK16
/*
public void removeStatementEventListener(StatementEventListener listener) {
...
...
@@ -391,7 +401,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
*/
//#endif
/**
* INTERNAL
*/
...
...
@@ -399,13 +409,13 @@ implements XAConnection, XAResource, JdbcConnectionListener
public
String
toString
()
{
return
getTraceObjectName
()
+
": url="
+
url
+
" user="
+
user
;
}
private
void
closeConnection
(
JdbcConnection
conn
)
throws
SQLException
{
if
(
conn
!=
null
)
{
conn
.
closeConnection
();
}
}
private
JdbcConnection
openConnection
()
throws
SQLException
{
Properties
info
=
new
Properties
();
info
.
setProperty
(
"user"
,
user
);
...
...
@@ -436,7 +446,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
buff
.
append
(
"\""
);
return
buff
.
toString
();
}
private
String
quoteFlags
(
int
flags
)
{
StringBuffer
buff
=
new
StringBuffer
();
if
((
flags
&
XAResource
.
TMENDRSCAN
)
!=
0
)
{
...
...
@@ -465,7 +475,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
if
((
flags
&
XAResource
.
XA_RDONLY
)
!=
0
)
{
buff
.
append
(
"|XAResource.XA_RDONLY"
);
}
}
if
(
buff
.
length
()
==
0
)
{
buff
.
append
(
"|XAResource.TMNOFLAGS"
);
}
...
...
h2/src/main/org/h2/log/UndoLog.java
浏览文件 @
f0bf7fad
...
...
@@ -67,14 +67,18 @@ public class UndoLog {
}
first
.
seek
(
file
);
}
records
.
remove
(
i
);
memoryUndo
--;
UndoLogRecord
r
=
(
UndoLogRecord
)
records
.
remove
(
i
);
if
(!
r
.
isStored
())
{
memoryUndo
--;
}
return
entry
;
}
public
void
add
(
UndoLogRecord
entry
)
throws
SQLException
{
records
.
add
(
entry
);
memoryUndo
++;
if
(!
entry
.
isStored
())
{
memoryUndo
++;
}
if
(
memoryUndo
>
database
.
getMaxMemoryUndo
()
&&
database
.
isPersistent
())
{
if
(
file
==
null
)
{
String
fileName
=
database
.
createTempFile
();
...
...
h2/src/main/org/h2/res/_messages_de.properties
浏览文件 @
f0bf7fad
...
...
@@ -157,6 +157,7 @@
90134
=
Der Zugriff auf die Klasse {0} ist nicht erlaubt
90135
=
Die Datenbank befindet sich im Exclusiv Modus; es k
\u
00F6nnen keine zus
\u
00E4tzlichen Verbindungen ge
\u
00F6ffnet werden
90136
=
Diese Outer Join Bedingung wird nicht unterst
\u
00FCtzt
\:
{0}
90137
=
\#
Can only assign to a variable, not to
\:
{0}
HY000
=
Allgemeiner Fehler
\:
{0}
HY004
=
Unbekannter Datentyp
\:
{0}
HYC00
=
Dieses Feature wird unterst
\u
00FCtzt
...
...
h2/src/main/org/h2/res/_messages_en.properties
浏览文件 @
f0bf7fad
...
...
@@ -157,6 +157,7 @@
90134
=
Access to the class {0} is denied
90135
=
The database is open in exclusive mode; can not open additional connections
90136
=
Unsupported outer join condition
\:
{0}
90137
=
Can only assign to a variable, not to
\:
{0}
HY000
=
General error
\:
{0}
HY004
=
Unknown data type
\:
{0}
HYC00
=
Feature not supported
...
...
h2/src/main/org/h2/res/_messages_ja.properties
浏览文件 @
f0bf7fad
...
...
@@ -157,6 +157,7 @@
90134
=
\#
Access to the class {0} is denied
90135
=
\#
The database is open in exclusive mode; can not open additional connections
90136
=
\#
Unsupported outer join condition
\:
{0}
90137
=
\#
Can only assign to a variable, not to
\:
{0}
HY000
=
\u
4E00
\u
822C
\u
30A8
\u
30E9
\u
30FC
\:
{0}
HY004
=
\u
4E0D
\u
660E
\u
306A
\u
30C7
\u
30FC
\u
30BF
\u
578B
\:
{0}
HYC00
=
\u
6A5F
\u
80FD
\u
306F
\u
30B5
\u
30DD
\u
30FC
\u
30C8
\u3055\u
308C
\u3066\u3044\u
307E
\u
305B
\u3093
...
...
h2/src/main/org/h2/res/_messages_pl.properties
浏览文件 @
f0bf7fad
...
...
@@ -157,6 +157,7 @@
90134
=
\#
Access to the class {0} is denied
90135
=
\#
The database is open in exclusive mode; can not open additional connections
90136
=
\#
Unsupported outer join condition
\:
{0}
90137
=
\#
Can only assign to a variable, not to
\:
{0}
HY000
=
Blad ogolny
\:
{0}
HY004
=
Nieznany typ danyche
\:
{0}
HYC00
=
Cecha nie jest wspierana
...
...
h2/src/main/org/h2/res/_messages_pt_br.properties
浏览文件 @
f0bf7fad
...
...
@@ -157,6 +157,7 @@
90134
=
\#
Access to the class {0} is denied
90135
=
\#
The database is open in exclusive mode; can not open additional connections
90136
=
\#
Unsupported outer join condition
\:
{0}
90137
=
\#
Can only assign to a variable, not to
\:
{0}
HY000
=
Erro geral
\:
{0}
HY004
=
Tipo de dados desconhecido
\:
{0}
HYC00
=
Recurso n
\u
00E3o suportado
...
...
h2/src/main/org/h2/server/TcpServer.java
浏览文件 @
f0bf7fad
...
...
@@ -163,7 +163,7 @@ public class TcpServer implements Service {
}
}
org
.
h2
.
Driver
.
load
();
url
=
(
ssl
?
"ssl"
:
"tcp"
)
+
"://
localhost
:"
+
port
;
url
=
(
ssl
?
"ssl"
:
"tcp"
)
+
"://
"
+
NetUtils
.
getLocalAddress
()
+
"
:"
+
port
;
}
public
String
getURL
()
{
...
...
@@ -266,7 +266,7 @@ public class TcpServer implements Service {
server
.
stopManagementDb
();
server
.
stop
=
true
;
try
{
Socket
s
=
new
Socket
(
"localhost"
,
port
);
Socket
s
=
NetUtils
.
createLoopbackSocket
(
port
,
false
);
s
.
close
();
}
catch
(
Exception
e
)
{
// try to connect - so that accept returns
...
...
h2/src/main/org/h2/server/ftp/FtpServer.java
浏览文件 @
f0bf7fad
...
...
@@ -182,7 +182,7 @@ public class FtpServer implements Service {
}
public
String
getURL
()
{
return
"ftp://
localhost
:"
+
port
;
return
"ftp://
"
+
NetUtils
.
getLocalAddress
()
+
"
:"
+
port
;
}
public
void
start
()
throws
SQLException
{
...
...
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
f0bf7fad
...
...
@@ -59,7 +59,7 @@ public class PgServer implements Service {
}
}
org
.
h2
.
Driver
.
load
();
url
=
"pg://
localhost
:"
+
port
;
url
=
"pg://
"
+
NetUtils
.
getLocalAddress
()
+
"
:"
+
port
;
// int testing;
// log = true;
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
f0bf7fad
...
...
@@ -227,7 +227,7 @@ public class WebServer implements Service {
for
(
int
i
=
0
;
i
<
LANGUAGES
.
length
;
i
++)
{
languages
.
add
(
LANGUAGES
[
i
][
0
]);
}
url
=
(
ssl
?
"https"
:
"http"
)
+
"://
localhost
:"
+
port
;
url
=
(
ssl
?
"https"
:
"http"
)
+
"://
"
+
NetUtils
.
getLocalAddress
()
+
"
:"
+
port
;
}
public
String
getURL
()
{
...
...
h2/src/main/org/h2/server/web/res/_text_uk.properties
浏览文件 @
f0bf7fad
差异被折叠。
点击展开。
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
f0bf7fad
...
...
@@ -317,6 +317,7 @@ public class DiskFile implements CacheWriter {
throw
Message
.
getInternalError
();
}
Storage
storage
=
database
.
getStorage
(
id
,
this
);
setUnused
(
i
,
blockCount
);
setBlockOwner
(
storage
,
i
,
blockCount
,
true
);
storage
.
incrementRecordCount
();
i
+=
blockCount
;
...
...
h2/src/main/org/h2/tools/SimpleResultSet.java
浏览文件 @
f0bf7fad
...
...
@@ -199,10 +199,10 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
close
();
return
false
;
}
/**
* Moves the current position to before the first row, that means resets the result set.
*
*
* @throws SQLException is this method is not supported
*/
public
void
beforeFirst
()
throws
SQLException
{
...
...
@@ -1242,7 +1242,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
throw
new
SQLException
(
"Invalid column index "
+
(
columnIndex
+
1
),
"90009"
);
}
}
private
Object
get
(
int
columnIndex
)
throws
SQLException
{
if
(
currentRow
==
null
)
{
throw
new
SQLException
(
"No data is available"
,
"02000"
);
...
...
@@ -1259,6 +1259,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
return
(
Column
)
columns
.
get
(
i
);
}
/** INTERNAL */
//#ifdef JDK16
/*
public RowId getRowId(int columnIndex) throws SQLException {
...
...
@@ -1267,6 +1268,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
*/
//#endif
/** INTERNAL */
//#ifdef JDK16
/*
public RowId getRowId(String columnName) throws SQLException {
...
...
h2/src/main/org/h2/util/NetUtils.java
浏览文件 @
f0bf7fad
...
...
@@ -25,7 +25,11 @@ public class NetUtils {
private
static
InetAddress
bindAddress
;
public
static
Socket
createLoopbackSocket
(
int
port
,
boolean
ssl
)
throws
IOException
{
return
createSocket
(
"127.0.0.1"
,
port
,
ssl
);
InetAddress
address
=
getBindAddress
();
if
(
address
==
null
)
{
address
=
InetAddress
.
getLocalHost
();
}
return
createSocket
(
address
.
getHostAddress
(),
port
,
ssl
);
}
public
static
Socket
createSocket
(
String
server
,
int
defaultPort
,
boolean
ssl
)
throws
IOException
{
...
...
@@ -75,7 +79,7 @@ public class NetUtils {
}
synchronized
(
NetUtils
.
class
)
{
if
(
bindAddress
==
null
)
{
bindAddress
=
InetAddress
.
getBy
Address
(
InetAddress
.
getByName
(
host
).
getAddress
()
);
bindAddress
=
InetAddress
.
getBy
Name
(
host
);
}
}
return
bindAddress
;
...
...
@@ -121,4 +125,14 @@ public class NetUtils {
return
null
;
}
public
static
String
getLocalAddress
()
{
InetAddress
bind
=
null
;
try
{
bind
=
getBindAddress
();
}
catch
(
UnknownHostException
e
)
{
// ignore
}
return
bind
==
null
?
"localhost"
:
bind
.
getHostAddress
();
}
}
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
f0bf7fad
...
...
@@ -150,18 +150,14 @@ java org.h2.test.TestAll timer
/*
Roadmap:
document SET method, variables
History:
send mail
Roadmap:
There is a problem with the h2.bindAddress build. When it is binding to 127.0.0.1,
the bind function works perfectly and I could confirm it no longer
listen to the ports of other IP addresses. However, when it is binding to normal IP
addresses, it always got the following exception.
Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken [90067-64]
at org.h2.message.Message.getSQLException(Message.java:89)
Remarks: I build with JDK 1.6
History:
User defined variables are now supported. Examples: SET @VAR=10;CALL @VAR
Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes
...
...
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
f0bf7fad
--- special grammar and test cases ---------------------------------------------------------------------------------------------
select x, set(@t, ifnull(@t, 0) + x) from system_range(1, 3);
> rows: 3
select * from system_range(1, 2) a,
(select * from system_range(1, 2) union select * from system_range(1, 2)
union select * from system_range(1, 1)) v where a.x = v.x;
...
...
h2/src/test/org/h2/test/testSimple.in.txt
浏览文件 @
f0bf7fad
call set(1, 2);
> exception;
CREATE TABLE TEST(A int NOT NULL, B int NOT NULL, C int) ;
ALTER TABLE TEST ADD CONSTRAINT CON UNIQUE(A,B);
ALTER TABLE TEST DROP C;
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
f0bf7fad
...
...
@@ -522,4 +522,4 @@ camel council merges spelled adaptive pull controller abstractions workarounds d
thousands ridvan incremented slots debugging inherit agar fulvio invisible biondi hundreds occupied remap retrieved involved
turkish fulfils iapi filesync
compares packets destroying echo homed hosts clock countries validated catches turning staging kills distance morning performs internationalization simulator constructed nicer
echo callablestatement procid homed getstart staging
\ No newline at end of file
echo callablestatement procid homed getstart staging prices
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论