Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c41b599b
提交
c41b599b
authored
10月 03, 2016
作者:
Noel Grandin
提交者:
GitHub
10月 03, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #369 from marschall/jdbc-debug-guards
Add guards to JDBC debug code
上级
9ecfb9eb
093560a1
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
72 行增加
和
28 行删除
+72
-28
JdbcArray.java
h2/src/main/org/h2/jdbc/JdbcArray.java
+18
-6
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+6
-2
JdbcPreparedStatement.java
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
+20
-8
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+28
-12
没有找到文件。
h2/src/main/org/h2/jdbc/JdbcArray.java
浏览文件 @
c41b599b
...
...
@@ -61,7 +61,9 @@ public class JdbcArray extends TraceObject implements Array {
@Override
public
Object
getArray
(
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getArray("
+
quoteMap
(
map
)+
");"
);
}
JdbcConnection
.
checkMap
(
map
);
checkClosed
();
return
get
();
...
...
@@ -82,7 +84,9 @@ public class JdbcArray extends TraceObject implements Array {
@Override
public
Object
getArray
(
long
index
,
int
count
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getArray("
+
index
+
", "
+
count
+
");"
);
}
checkClosed
();
return
get
(
index
,
count
);
}
catch
(
Exception
e
)
{
...
...
@@ -104,7 +108,9 @@ public class JdbcArray extends TraceObject implements Array {
public
Object
getArray
(
long
index
,
int
count
,
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getArray("
+
index
+
", "
+
count
+
", "
+
quoteMap
(
map
)+
");"
);
}
checkClosed
();
JdbcConnection
.
checkMap
(
map
);
return
get
(
index
,
count
);
...
...
@@ -175,7 +181,9 @@ public class JdbcArray extends TraceObject implements Array {
@Override
public
ResultSet
getResultSet
(
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getResultSet("
+
quoteMap
(
map
)+
");"
);
}
checkClosed
();
JdbcConnection
.
checkMap
(
map
);
return
getResultSet
(
get
(),
0
);
...
...
@@ -197,7 +205,9 @@ public class JdbcArray extends TraceObject implements Array {
@Override
public
ResultSet
getResultSet
(
long
index
,
int
count
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getResultSet("
+
index
+
", "
+
count
+
");"
);
}
checkClosed
();
return
getResultSet
(
get
(
index
,
count
),
index
-
1
);
}
catch
(
Exception
e
)
{
...
...
@@ -221,7 +231,9 @@ public class JdbcArray extends TraceObject implements Array {
public
ResultSet
getResultSet
(
long
index
,
int
count
,
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getResultSet("
+
index
+
", "
+
count
+
", "
+
quoteMap
(
map
)+
");"
);
}
checkClosed
();
JdbcConnection
.
checkMap
(
map
);
return
getResultSet
(
get
(
index
,
count
),
index
-
1
);
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
c41b599b
...
...
@@ -882,7 +882,9 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
@Override
public
void
setTypeMap
(
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"setTypeMap("
+
quoteMap
(
map
)
+
");"
);
}
checkMap
(
map
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -1044,7 +1046,9 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
public
void
rollback
(
Savepoint
savepoint
)
throws
SQLException
{
try
{
JdbcSavepoint
sp
=
convertSavepoint
(
savepoint
);
if
(
isDebugEnabled
())
{
debugCode
(
"rollback("
+
sp
.
getTraceObjectName
()
+
");"
);
}
checkClosedForWrite
();
try
{
sp
.
rollback
();
...
...
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
浏览文件 @
c41b599b
...
...
@@ -1272,7 +1272,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements
public
int
executeUpdate
(
String
sql
,
int
autoGeneratedKeys
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"executeUpdate("
+
quote
(
sql
)+
", "
+
autoGeneratedKeys
+
");"
);
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -1291,8 +1293,10 @@ public class JdbcPreparedStatement extends JdbcStatement implements
public
int
executeUpdate
(
String
sql
,
int
[]
columnIndexes
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"executeUpdate("
+
quote
(
sql
)
+
", "
+
quoteIntArray
(
columnIndexes
)
+
");"
);
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -1310,8 +1314,10 @@ public class JdbcPreparedStatement extends JdbcStatement implements
public
int
executeUpdate
(
String
sql
,
String
[]
columnNames
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"executeUpdate("
+
quote
(
sql
)
+
", "
+
quoteArray
(
columnNames
)
+
");"
);
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT
);
}
catch
(
Exception
e
)
{
...
...
@@ -1330,7 +1336,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements
public
boolean
execute
(
String
sql
,
int
autoGeneratedKeys
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"execute("
+
quote
(
sql
)
+
", "
+
autoGeneratedKeys
+
");"
);
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT
);
}
catch
(
Exception
e
)
{
...
...
@@ -1348,7 +1356,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements
@Override
public
boolean
execute
(
String
sql
,
int
[]
columnIndexes
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"execute("
+
quote
(
sql
)
+
", "
+
quoteIntArray
(
columnIndexes
)
+
");"
);
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -1366,7 +1376,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements
public
boolean
execute
(
String
sql
,
String
[]
columnNames
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"execute("
+
quote
(
sql
)
+
", "
+
quoteArray
(
columnNames
)
+
");"
);
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT
);
}
catch
(
Exception
e
)
{
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
c41b599b
...
...
@@ -1018,8 +1018,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
Blob
getBlob
(
int
columnIndex
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
BLOB
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Blob"
,
TraceObject
.
BLOB
,
id
,
"getBlob("
+
columnIndex
+
")"
);
}
Value
v
=
get
(
columnIndex
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcBlob
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -1039,8 +1041,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
Blob
getBlob
(
String
columnLabel
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
BLOB
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Blob"
,
TraceObject
.
BLOB
,
id
,
"getBlob("
+
quote
(
columnLabel
)
+
")"
);
}
Value
v
=
get
(
columnLabel
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcBlob
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -1133,7 +1137,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
Clob
getClob
(
int
columnIndex
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
CLOB
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Clob"
,
TraceObject
.
CLOB
,
id
,
"getClob("
+
columnIndex
+
")"
);
}
Value
v
=
get
(
columnIndex
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcClob
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -1153,8 +1159,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
Clob
getClob
(
String
columnLabel
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
CLOB
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Clob"
,
TraceObject
.
CLOB
,
id
,
"getClob("
+
quote
(
columnLabel
)
+
")"
);
}
Value
v
=
get
(
columnLabel
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcClob
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -1174,7 +1182,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
Array
getArray
(
int
columnIndex
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
ARRAY
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Clob"
,
TraceObject
.
ARRAY
,
id
,
"getArray("
+
columnIndex
+
")"
);
}
Value
v
=
get
(
columnIndex
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcArray
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -1194,8 +1204,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
Array
getArray
(
String
columnLabel
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
ARRAY
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Clob"
,
TraceObject
.
ARRAY
,
id
,
"getArray("
+
quote
(
columnLabel
)
+
")"
);
}
Value
v
=
get
(
columnLabel
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcArray
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -3449,7 +3461,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
NClob
getNClob
(
int
columnIndex
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
CLOB
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"NClob"
,
TraceObject
.
CLOB
,
id
,
"getNClob("
+
columnIndex
+
")"
);
}
Value
v
=
get
(
columnIndex
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcClob
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
@@ -3469,7 +3483,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
NClob
getNClob
(
String
columnLabel
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
CLOB
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"NClob"
,
TraceObject
.
CLOB
,
id
,
"getNClob("
+
columnLabel
+
")"
);
}
Value
v
=
get
(
columnLabel
);
return
v
==
ValueNull
.
INSTANCE
?
null
:
new
JdbcClob
(
conn
,
v
,
id
);
}
catch
(
Exception
e
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论