Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
67eb291e
提交
67eb291e
authored
7 年前
作者:
sylvain-ilm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
restored the more specific code for Trigger, as requested
上级
65f8e661
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
3 行删除
+17
-3
TriggerObject.java
h2/src/main/org/h2/schema/TriggerObject.java
+10
-1
SourceCompiler.java
h2/src/main/org/h2/util/SourceCompiler.java
+7
-2
没有找到文件。
h2/src/main/org/h2/schema/TriggerObject.java
浏览文件 @
67eb291e
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
*/
*/
package
org
.
h2
.
schema
;
package
org
.
h2
.
schema
;
import
java.lang.reflect.Method
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
...
@@ -93,7 +94,15 @@ public class TriggerObject extends SchemaObjectBase {
...
@@ -93,7 +94,15 @@ public class TriggerObject extends SchemaObjectBase {
String
fullClassName
=
Constants
.
USER_PACKAGE
+
".trigger."
+
getName
();
String
fullClassName
=
Constants
.
USER_PACKAGE
+
".trigger."
+
getName
();
compiler
.
setSource
(
fullClassName
,
triggerSource
);
compiler
.
setSource
(
fullClassName
,
triggerSource
);
try
{
try
{
return
(
Trigger
)
compiler
.
invoke
(
fullClassName
);
if
(
SourceCompiler
.
isJavaxScriptSource
(
triggerSource
))
{
return
(
Trigger
)
compiler
.
getCompiledScript
(
fullClassName
).
eval
();
}
else
{
final
Method
m
=
compiler
.
getMethod
(
fullClassName
);
if
(
m
.
getParameterTypes
().
length
>
0
)
{
throw
new
IllegalStateException
(
"No parameters are allowed for a trigger"
);
}
return
(
Trigger
)
m
.
invoke
(
null
);
}
}
catch
(
DbException
e
)
{
}
catch
(
DbException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/SourceCompiler.java
浏览文件 @
67eb291e
...
@@ -190,8 +190,13 @@ public class SourceCompiler {
...
@@ -190,8 +190,13 @@ public class SourceCompiler {
return
source
.
startsWith
(
"#ruby"
);
return
source
.
startsWith
(
"#ruby"
);
}
}
// whether the passed source should be compiled using javax.script.ScriptEngineManager
/**
private
static
boolean
isJavaxScriptSource
(
String
source
)
{
* Whether the passed source can be compiled using {@link javax.script.ScriptEngineManager}.
*
* @param source the source to test.
* @return <code>true</code> if {@link #getCompiledScript(String)} can be called.
*/
public
static
boolean
isJavaxScriptSource
(
String
source
)
{
return
isJavascriptSource
(
source
)
||
isRubySource
(
source
);
return
isJavascriptSource
(
source
)
||
isRubySource
(
source
);
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论