Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
aa4c335b
提交
aa4c335b
authored
11月 06, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add more getSQL(StringBuilder) methods
上级
f592e317
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
54 行增加
和
52 行删除
+54
-52
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+1
-1
ConstraintCheck.java
h2/src/main/org/h2/constraint/ConstraintCheck.java
+2
-2
TableFunction.java
h2/src/main/org/h2/expression/TableFunction.java
+9
-10
Aggregate.java
h2/src/main/org/h2/expression/aggregate/Aggregate.java
+2
-1
DataAnalysisOperation.java
...in/org/h2/expression/aggregate/DataAnalysisOperation.java
+2
-1
Window.java
h2/src/main/org/h2/expression/aggregate/Window.java
+10
-11
WindowFrame.java
h2/src/main/org/h2/expression/aggregate/WindowFrame.java
+12
-8
WindowFrameBound.java
...rc/main/org/h2/expression/aggregate/WindowFrameBound.java
+8
-7
Column.java
h2/src/main/org/h2/table/Column.java
+8
-11
没有找到文件。
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
aa4c335b
...
...
@@ -303,7 +303,7 @@ public class Insert extends Prepared implements ResultTarget {
if
(
e
==
null
)
{
buff
.
append
(
"DEFAULT"
);
}
else
{
buff
.
append
(
e
.
getSQL
());
e
.
getSQL
(
buff
.
builder
());
}
}
buff
.
append
(
')'
);
...
...
h2/src/main/org/h2/constraint/ConstraintCheck.java
浏览文件 @
aa4c335b
...
...
@@ -58,8 +58,8 @@ public class ConstraintCheck extends Constraint {
if
(
comment
!=
null
)
{
buff
.
append
(
" COMMENT "
).
append
(
StringUtils
.
quoteStringSQL
(
comment
));
}
buff
.
append
(
" CHECK
"
).
append
(
StringUtils
.
enclose
(
expr
.
getSQL
()))
.
append
(
"
NOCHECK"
);
buff
.
append
(
" CHECK
("
);
expr
.
getUnenclosedSQL
(
buff
).
append
(
")
NOCHECK"
);
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/expression/TableFunction.java
浏览文件 @
aa4c335b
...
...
@@ -13,7 +13,6 @@ import org.h2.engine.Session;
import
org.h2.message.DbException
;
import
org.h2.result.LocalResult
;
import
org.h2.table.Column
;
import
org.h2.util.StatementBuilder
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueNull
;
...
...
@@ -46,16 +45,16 @@ public class TableFunction extends Function {
}
@Override
public
String
getSQL
(
)
{
StatementBuilder
buff
=
new
StatementBuilder
(
getName
()
);
buff
.
append
(
'('
);
int
i
=
0
;
for
(
Expression
e
:
args
)
{
buff
.
appendExceptFirst
(
", "
);
bu
ff
.
append
(
columnList
[
i
++
].
getCreateSQL
()).
append
(
'='
);
e
.
getSQL
(
buff
.
builder
()
);
public
String
Builder
getSQL
(
StringBuilder
builder
)
{
builder
.
append
(
getName
()).
append
(
'('
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
bu
ilder
.
append
(
columnList
[
i
].
getCreateSQL
()).
append
(
'='
);
args
[
i
].
getSQL
(
builder
);
}
return
bu
ff
.
append
(
')'
).
toString
(
);
return
bu
ilder
.
append
(
')'
);
}
...
...
h2/src/main/org/h2/expression/aggregate/Aggregate.java
浏览文件 @
aa4c335b
...
...
@@ -827,7 +827,8 @@ public class Aggregate extends AbstractAggregate {
builder
.
append
(
"(DISTINCT "
);
on
.
getSQL
(
builder
).
append
(
')'
);
}
else
{
builder
.
append
(
StringUtils
.
enclose
(
on
.
getSQL
()));
builder
.
append
(
'('
);
on
.
getUnenclosedSQL
(
builder
).
append
(
')'
);
}
return
appendTailConditions
(
builder
);
}
...
...
h2/src/main/org/h2/expression/aggregate/DataAnalysisOperation.java
浏览文件 @
aa4c335b
...
...
@@ -351,7 +351,8 @@ public abstract class DataAnalysisOperation extends Expression {
protected
StringBuilder
appendTailConditions
(
StringBuilder
builder
)
{
if
(
over
!=
null
)
{
builder
.
append
(
' '
).
append
(
over
.
getSQL
());
builder
.
append
(
' '
);
over
.
getSQL
(
builder
);
}
return
builder
;
}
...
...
h2/src/main/org/h2/expression/aggregate/Window.java
浏览文件 @
aa4c335b
...
...
@@ -203,16 +203,15 @@ public final class Window {
}
/**
*
Returns SQL representation
.
*
Appends SQL representation to the specified builder
.
*
* @return SQL representation.
* @see Expression#getSQL()
* @param builder
* string builder
* @return the specified string builder
* @see Expression#getSQL(StringBuilder)
*/
public
String
getSQL
()
{
if
(
partitionBy
==
null
&&
orderBy
==
null
&&
frame
==
null
)
{
return
"OVER ()"
;
}
StringBuilder
builder
=
new
StringBuilder
().
append
(
"OVER ("
);
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
builder
.
append
(
"OVER ("
);
if
(
partitionBy
!=
null
)
{
builder
.
append
(
"PARTITION BY "
);
for
(
int
i
=
0
;
i
<
partitionBy
.
size
();
i
++)
{
...
...
@@ -227,9 +226,9 @@ public final class Window {
if
(
builder
.
charAt
(
builder
.
length
()
-
1
)
!=
'('
)
{
builder
.
append
(
' '
);
}
builder
.
append
(
frame
.
getSQL
()
);
frame
.
getSQL
(
builder
);
}
return
builder
.
append
(
')'
)
.
toString
()
;
return
builder
.
append
(
')'
);
}
/**
...
...
@@ -256,7 +255,7 @@ public final class Window {
@Override
public
String
toString
()
{
return
getSQL
();
return
getSQL
(
new
StringBuilder
()).
toString
(
);
}
}
h2/src/main/org/h2/expression/aggregate/WindowFrame.java
浏览文件 @
aa4c335b
...
...
@@ -584,23 +584,27 @@ public final class WindowFrame {
}
/**
*
Returns SQL representation
.
*
Append SQL representation to the specified builder
.
*
* @return SQL representation.
* @see org.h2.expression.Expression#getSQL()
* @param builder
* string builder
* @return the specified string builder
* @see org.h2.expression.Expression#getSQL(StringBuilder)
*/
public
String
getSQL
()
{
StringBuilder
builder
=
new
StringBuilder
();
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
builder
.
append
(
units
.
getSQL
());
if
(
following
==
null
)
{
builder
.
append
(
' '
).
append
(
starting
.
getSQL
(
false
));
builder
.
append
(
' '
);
starting
.
getSQL
(
builder
,
false
);
}
else
{
builder
.
append
(
" BETWEEN "
).
append
(
starting
.
getSQL
(
false
)).
append
(
" AND "
).
append
(
following
.
getSQL
(
true
));
builder
.
append
(
" BETWEEN "
);
starting
.
getSQL
(
builder
,
false
).
append
(
" AND "
);
following
.
getSQL
(
builder
,
true
);
}
if
(
exclusion
!=
WindowFrameExclusion
.
EXCLUDE_NO_OTHERS
)
{
builder
.
append
(
' '
).
append
(
exclusion
.
getSQL
());
}
return
builder
.
toString
()
;
return
builder
;
}
}
h2/src/main/org/h2/expression/aggregate/WindowFrameBound.java
浏览文件 @
aa4c335b
...
...
@@ -52,20 +52,21 @@ public class WindowFrameBound {
}
/**
*
Returns SQL representation
.
*
Appends SQL representation to the specified builder
.
*
* @param builder
* string builder
* @param following
* if false return SQL for starting clause, if true return SQL
* for following clause
* @return
SQL representation.
* @see Expression#getSQL()
* @return
the specified string builder
* @see Expression#getSQL(
StringBuilder
)
*/
public
String
getSQL
(
boolean
following
)
{
public
String
Builder
getSQL
(
StringBuilder
builder
,
boolean
following
)
{
if
(
type
==
WindowFrameBoundType
.
PRECEDING
||
type
==
WindowFrameBoundType
.
FOLLOWING
)
{
StringBuilder
builder
=
new
StringBuilder
();
return
value
.
getSQL
(
builder
).
append
(
' '
).
append
(
type
.
getSQL
()).
toString
();
value
.
getSQL
(
builder
).
append
(
' '
);
}
return
type
.
getSQL
(
);
return
builder
.
append
(
type
.
getSQL
()
);
}
}
h2/src/main/org/h2/table/Column.java
浏览文件 @
aa4c335b
...
...
@@ -546,20 +546,17 @@ public class Column {
}
if
(
defaultExpression
!=
null
)
{
String
sql
=
defaultExpression
.
getSQL
();
if
(
sql
!=
null
)
{
if
(
isComputed
)
{
buff
.
append
(
" AS "
).
append
(
sql
);
}
else
if
(
defaultExpression
!=
null
)
{
buff
.
append
(
" DEFAULT "
).
append
(
sql
);
}
if
(
isComputed
)
{
buff
.
append
(
" AS "
);
defaultExpression
.
getSQL
(
buff
);
}
else
if
(
defaultExpression
!=
null
)
{
buff
.
append
(
" DEFAULT "
);
defaultExpression
.
getSQL
(
buff
);
}
}
if
(
onUpdateExpression
!=
null
)
{
String
sql
=
onUpdateExpression
.
getSQL
();
if
(
sql
!=
null
)
{
buff
.
append
(
" ON UPDATE "
).
append
(
sql
);
}
buff
.
append
(
" ON UPDATE "
);
onUpdateExpression
.
getSQL
(
buff
);
}
if
(!
nullable
)
{
buff
.
append
(
" NOT NULL"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论