Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
fb7066ce
提交
fb7066ce
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JaQu: the decompiler has been improved.
上级
76feb2b3
master
noel-pr1
plus33-master
pr/267
stumc-Issue#576
version-1.1.x
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
version-1.4.191
version-1.4.190
version-1.4.188
version-1.4.187
version-1.4.186
version-1.4.185
version-1.4.184
version-1.4.183
version-1.4.182
version-1.4.181
version-1.4.178
version-1.4.177
version-1.3
version-1.2
version-1.1
version-1.0
无相关合并请求
全部展开
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
1051 行增加
和
501 行删除
+1051
-501
TableDefinition.java
h2/src/tools/org/h2/jaqu/TableDefinition.java
+4
-0
Token.java
h2/src/tools/org/h2/jaqu/Token.java
+1
-1
And.java
h2/src/tools/org/h2/jaqu/bytecode/And.java
+35
-0
ArrayGet.java
h2/src/tools/org/h2/jaqu/bytecode/ArrayGet.java
+38
-0
CaseWhen.java
h2/src/tools/org/h2/jaqu/bytecode/CaseWhen.java
+51
-0
ClassReader.java
h2/src/tools/org/h2/jaqu/bytecode/ClassReader.java
+489
-500
Constant.java
h2/src/tools/org/h2/jaqu/bytecode/Constant.java
+37
-0
ConstantNumber.java
h2/src/tools/org/h2/jaqu/bytecode/ConstantNumber.java
+59
-0
ConstantString.java
h2/src/tools/org/h2/jaqu/bytecode/ConstantString.java
+44
-0
Function.java
h2/src/tools/org/h2/jaqu/bytecode/Function.java
+36
-0
Not.java
h2/src/tools/org/h2/jaqu/bytecode/Not.java
+44
-0
Null.java
h2/src/tools/org/h2/jaqu/bytecode/Null.java
+33
-0
Operation.java
h2/src/tools/org/h2/jaqu/bytecode/Operation.java
+104
-0
Or.java
h2/src/tools/org/h2/jaqu/bytecode/Or.java
+36
-0
Variable.java
h2/src/tools/org/h2/jaqu/bytecode/Variable.java
+40
-0
没有找到文件。
h2/src/tools/org/h2/jaqu/TableDefinition.java
浏览文件 @
fb7066ce
...
...
@@ -94,6 +94,10 @@ class TableDefinition<T> {
tableName
=
clazz
.
getSimpleName
();
}
List
<
FieldDefinition
>
getFields
()
{
return
fields
;
}
void
setTableName
(
String
tableName
)
{
this
.
tableName
=
tableName
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/Token.java
浏览文件 @
fb7066ce
...
...
@@ -9,7 +9,7 @@ package org.h2.jaqu;
/**
* Classes implementing this interface can be used as a token in a statement.
*/
interface
Token
{
public
interface
Token
{
/**
* Append the SQL to the given statement using the given query.
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/And.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* An AND expression.
*/
public
class
And
implements
Token
{
private
final
Token
left
,
right
;
private
And
(
Token
left
,
Token
right
)
{
this
.
left
=
left
;
this
.
right
=
right
;
}
static
And
get
(
Token
left
,
Token
right
)
{
return
new
And
(
left
,
right
);
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
left
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
" AND "
);
right
.
appendSQL
(
stat
,
query
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/ArrayGet.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* An array access operation.
*/
public
class
ArrayGet
implements
Token
{
private
final
Token
variable
;
private
final
Token
index
;
private
ArrayGet
(
Token
variable
,
Token
index
)
{
this
.
variable
=
variable
;
this
.
index
=
index
;
}
static
ArrayGet
get
(
Token
variable
,
Token
index
)
{
return
new
ArrayGet
(
variable
,
index
);
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
// untested
variable
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
"["
);
index
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
"]"
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/CaseWhen.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* A conditional expression.
*/
public
class
CaseWhen
implements
Token
{
private
final
Token
condition
,
ifTrue
,
ifFalse
;
private
CaseWhen
(
Token
condition
,
Token
ifTrue
,
Token
ifFalse
)
{
this
.
condition
=
condition
;
this
.
ifTrue
=
ifTrue
;
this
.
ifFalse
=
ifFalse
;
}
static
Token
get
(
Token
condition
,
Token
ifTrue
,
Token
ifFalse
)
{
if
(
"0"
.
equals
(
ifTrue
.
toString
())
&&
"1"
.
equals
(
ifFalse
.
toString
()))
{
return
Not
.
get
(
condition
);
}
else
if
(
"1"
.
equals
(
ifTrue
.
toString
())
&&
"0"
.
equals
(
ifFalse
.
toString
()))
{
return
condition
;
}
else
if
(
"0"
.
equals
(
ifTrue
.
toString
()))
{
return
And
.
get
(
Not
.
get
(
condition
),
ifFalse
);
}
return
new
CaseWhen
(
condition
,
ifTrue
,
ifFalse
);
}
public
String
toString
()
{
return
"CASEWHEN("
+
condition
+
", "
+
ifTrue
+
", "
+
ifFalse
+
")"
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"CASEWHEN "
);
condition
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
" THEN "
);
ifTrue
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
" ELSE "
);
ifFalse
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
" END"
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/
util
/ClassReader.java
→
h2/src/tools/org/h2/jaqu/
bytecode
/ClassReader.java
浏览文件 @
fb7066ce
差异被折叠。
点击展开。
h2/src/tools/org/h2/jaqu/bytecode/Constant.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Token
;
/**
* An expression in the constant pool.
*/
public
interface
Constant
extends
Token
{
/**
* The constant pool type.
*/
enum
Type
{
STRING
,
INT
,
FLOAT
,
DOUBLE
,
LONG
,
CLASS_REF
,
STRING_REF
,
FIELD_REF
,
METHOD_REF
,
INTERFACE_METHOD_REF
,
NAME_AND_TYPE
}
Constant
.
Type
getType
();
int
intValue
();
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/ConstantNumber.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
/**
* A literal number.
*/
public
class
ConstantNumber
implements
Constant
{
private
final
String
value
;
private
final
Type
type
;
private
final
long
longValue
;
private
ConstantNumber
(
String
value
,
long
longValue
,
Type
type
)
{
this
.
value
=
value
;
this
.
longValue
=
longValue
;
this
.
type
=
type
;
}
static
ConstantNumber
get
(
String
v
)
{
return
new
ConstantNumber
(
v
,
0
,
Type
.
STRING
);
}
static
ConstantNumber
get
(
int
v
)
{
return
new
ConstantNumber
(
""
+
v
,
v
,
Type
.
INT
);
}
static
ConstantNumber
get
(
long
v
)
{
return
new
ConstantNumber
(
""
+
v
,
v
,
Type
.
LONG
);
}
static
ConstantNumber
get
(
String
s
,
long
x
,
Type
type
)
{
return
new
ConstantNumber
(
s
,
x
,
type
);
}
public
int
intValue
()
{
return
(
int
)
longValue
;
}
public
String
toString
()
{
return
value
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
toString
());
}
public
Constant
.
Type
getType
()
{
return
type
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/ConstantString.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.util.StringUtils
;
/**
* A string constant.
*/
public
class
ConstantString
implements
Constant
{
private
final
String
value
;
private
ConstantString
(
String
value
)
{
this
.
value
=
value
;
}
static
ConstantString
get
(
String
v
)
{
return
new
ConstantString
(
v
);
}
public
String
toString
()
{
return
value
;
}
public
int
intValue
()
{
return
0
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
StringUtils
.
quoteStringSQL
(
value
));
}
public
Constant
.
Type
getType
()
{
return
Constant
.
Type
.
STRING
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/Function.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* A method call.
*/
class
Function
implements
Token
{
private
final
String
name
;
private
final
Token
expr
;
Function
(
String
name
,
Token
expr
)
{
this
.
name
=
name
;
this
.
expr
=
expr
;
}
public
String
toString
()
{
return
name
+
"("
+
expr
+
")"
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
// untested
stat
.
appendSQL
(
name
+
"("
);
expr
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
")"
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/Not.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* A NOT condition.
*/
public
class
Not
implements
Token
{
private
Token
expr
;
private
Not
(
Token
expr
)
{
this
.
expr
=
expr
;
}
static
Token
get
(
Token
expr
)
{
if
(
expr
instanceof
Not
)
{
return
((
Not
)
expr
).
expr
;
}
else
if
(
expr
instanceof
Operation
)
{
return
((
Operation
)
expr
).
reverse
();
}
return
new
Not
(
expr
);
}
Token
not
()
{
return
expr
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
// untested
stat
.
appendSQL
(
"NOT("
);
expr
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
")"
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/Null.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* The Java 'null'.
*/
public
class
Null
implements
Token
{
static
final
Null
INSTANCE
=
new
Null
();
private
Null
()
{
// don't allow to create new instances
}
public
String
toString
()
{
return
"null"
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
// untested
stat
.
appendSQL
(
"NULL"
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/Operation.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* A mathematical or comparison operation.
*/
class
Operation
implements
Token
{
/**
* The operation type.
*/
enum
Type
{
EQUALS
(
"="
)
{
Type
reverse
()
{
return
NOT_EQUALS
;
}
},
NOT_EQUALS
(
"<>"
)
{
Type
reverse
()
{
return
EQUALS
;
}
},
BIGGER
(
">"
)
{
Type
reverse
()
{
return
SMALLER_EQUALS
;
}
},
BIGGER_EQUALS
(
">="
)
{
Type
reverse
()
{
return
SMALLER
;
}
},
SMALLER_EQUALS
(
"<="
)
{
Type
reverse
()
{
return
BIGGER
;
}
},
SMALLER
(
"<"
)
{
Type
reverse
()
{
return
BIGGER_EQUALS
;
}
},
ADD
(
"+"
),
SUBTRACT
(
"-"
),
MULTIPLY
(
"*"
),
DIVIDE
(
"/"
),
MOD
(
"%"
);
private
String
name
;
Type
(
String
name
)
{
this
.
name
=
name
;
}
public
String
toString
()
{
return
name
;
}
Type
reverse
()
{
return
null
;
}
}
private
final
Token
left
,
right
;
private
final
Type
op
;
private
Operation
(
Token
left
,
Type
op
,
Token
right
)
{
this
.
left
=
left
;
this
.
op
=
op
;
this
.
right
=
right
;
}
static
Token
get
(
Token
left
,
Type
op
,
Token
right
)
{
if
(
op
==
Type
.
NOT_EQUALS
&&
"0"
.
equals
(
right
.
toString
()))
{
return
left
;
}
return
new
Operation
(
left
,
op
,
right
);
}
public
String
toString
()
{
return
left
+
" "
+
op
+
" "
+
right
;
}
public
Token
reverse
()
{
return
get
(
left
,
op
.
reverse
(),
right
);
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
left
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
op
.
toString
());
right
.
appendSQL
(
stat
,
query
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/Or.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* An OR expression.
*/
public
class
Or
implements
Token
{
private
final
Token
left
,
right
;
private
Or
(
Token
left
,
Token
right
)
{
this
.
left
=
left
;
this
.
right
=
right
;
}
static
Or
get
(
Token
left
,
Token
right
)
{
return
new
Or
(
left
,
right
);
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
// untested
left
.
appendSQL
(
stat
,
query
);
stat
.
appendSQL
(
" OR "
);
right
.
appendSQL
(
stat
,
query
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/Variable.java
0 → 100644
浏览文件 @
fb7066ce
/*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
jaqu
.
bytecode
;
import
org.h2.jaqu.Query
;
import
org.h2.jaqu.SQLStatement
;
import
org.h2.jaqu.Token
;
/**
* A variable.
*/
public
class
Variable
implements
Token
{
static
final
Variable
THIS
=
new
Variable
(
"this"
,
null
);
private
final
String
name
;
private
final
Object
obj
;
private
Variable
(
String
name
,
Object
obj
)
{
this
.
name
=
name
;
this
.
obj
=
obj
;
}
static
Variable
get
(
String
name
,
Object
obj
)
{
return
new
Variable
(
name
,
obj
);
}
public
String
toString
()
{
return
name
;
}
public
<
T
>
void
appendSQL
(
SQLStatement
stat
,
Query
<
T
>
query
)
{
query
.
appendSQL
(
stat
,
obj
);
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论