Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
576b3c8f
提交
576b3c8f
authored
8 年前
作者:
Sergi Vladykin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Incapsulated setSchema/getSchema logic in SessionInterface
上级
56d4c7e9
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
34 行增加
和
11 行删除
+34
-11
Session.java
h2/src/main/org/h2/engine/Session.java
+7
-0
SessionInterface.java
h2/src/main/org/h2/engine/SessionInterface.java
+15
-1
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+10
-0
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+2
-10
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
576b3c8f
...
@@ -1221,10 +1221,17 @@ public class Session extends SessionWithState {
...
@@ -1221,10 +1221,17 @@ public class Session extends SessionWithState {
this
.
currentSchemaName
=
schema
.
getName
();
this
.
currentSchemaName
=
schema
.
getName
();
}
}
@Override
public
String
getCurrentSchemaName
()
{
public
String
getCurrentSchemaName
()
{
return
currentSchemaName
;
return
currentSchemaName
;
}
}
@Override
public
void
setCurrentSchemaName
(
String
schemaName
)
{
Schema
schema
=
database
.
getSchema
(
schemaName
);
setCurrentSchema
(
schema
);
}
/**
/**
* Create an internal connection. This connection is used when initializing
* Create an internal connection. This connection is used when initializing
* triggers, and when calling user defined functions.
* triggers, and when calling user defined functions.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionInterface.java
浏览文件 @
576b3c8f
...
@@ -7,8 +7,8 @@ package org.h2.engine;
...
@@ -7,8 +7,8 @@ package org.h2.engine;
import
java.io.Closeable
;
import
java.io.Closeable
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.CommandInterface
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.Trace
;
import
org.h2.message.Trace
;
import
org.h2.store.DataHandler
;
import
org.h2.store.DataHandler
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
...
@@ -140,4 +140,18 @@ public interface SessionInterface extends Closeable {
...
@@ -140,4 +140,18 @@ public interface SessionInterface extends Closeable {
* @return true if this session is remote
* @return true if this session is remote
*/
*/
boolean
isRemote
();
boolean
isRemote
();
/**
* Set current schema as in {@link JdbcConnection#setSchema(String)}.
*
* @param schema the schema name
*/
void
setCurrentSchemaName
(
String
schema
);
/**
* Get current schema as in {@link JdbcConnection#getSchema()}.
*
* @return the current schema name
*/
String
getCurrentSchemaName
();
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
576b3c8f
...
@@ -858,4 +858,14 @@ public class SessionRemote extends SessionWithState implements DataHandler {
...
@@ -858,4 +858,14 @@ public class SessionRemote extends SessionWithState implements DataHandler {
public
boolean
isRemote
()
{
public
boolean
isRemote
()
{
return
true
;
return
true
;
}
}
@Override
public
String
getCurrentSchemaName
()
{
throw
DbException
.
getUnsupportedException
(
"getSchema && remote session"
);
}
@Override
public
void
setCurrentSchemaName
(
String
schema
)
{
throw
DbException
.
getUnsupportedException
(
"setSchema && remote session"
);
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
576b3c8f
...
@@ -1903,12 +1903,7 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
...
@@ -1903,12 +1903,7 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
debugCodeCall
(
"setSchema"
,
schema
);
debugCodeCall
(
"setSchema"
,
schema
);
}
}
checkClosed
();
checkClosed
();
if
(
session
.
isRemote
())
{
session
.
setCurrentSchemaName
(
schema
);
throw
DbException
.
getUnsupportedException
(
"setSchema && remote session"
);
}
Database
database
=
(
Database
)
session
.
getDataHandler
();
Schema
s
=
database
.
getSchema
(
schema
);
((
Session
)
session
).
setCurrentSchema
(
s
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
@@ -1926,10 +1921,7 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
...
@@ -1926,10 +1921,7 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
debugCodeCall
(
"getSchema"
);
debugCodeCall
(
"getSchema"
);
}
}
checkClosed
();
checkClosed
();
if
(
session
.
isRemote
())
{
return
session
.
getCurrentSchemaName
();
throw
DbException
.
getUnsupportedException
(
"getSchema && remote session"
);
}
return
((
Session
)
session
).
getCurrentSchemaName
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论