Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
common
Commits
6d0b78f0
Commit
6d0b78f0
authored
Feb 13, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
59b45fdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
JdbcTemplate.java
src/main/java/com/egolm/common/jdbc/JdbcTemplate.java
+45
-0
No files found.
src/main/java/com/egolm/common/jdbc/JdbcTemplate.java
View file @
6d0b78f0
...
@@ -552,6 +552,51 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
...
@@ -552,6 +552,51 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
});
});
}
}
public
List
<
Object
>
exec
(
final
String
sql
,
Map
<
Integer
,
Integer
>
out
,
final
Object
...
args
)
{
showSql
(
sql
,
args
);
return
super
.
execute
(
new
CallableStatementCreator
()
{
public
CallableStatement
createCallableStatement
(
final
Connection
con
)
throws
SQLException
{
final
CallableStatement
cs
=
con
.
prepareCall
(
sql
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
cs
.
setObject
(
i
+
1
,
args
[
i
]);
}
if
(
out
!=
null
&&
out
.
size
()
>
0
)
{
for
(
Integer
key
:
out
.
keySet
())
{
cs
.
registerOutParameter
(
key
,
out
.
get
(
key
));
}
}
return
cs
;
}
},
new
CallableStatementCallback
<
List
<
Object
>>()
{
public
List
<
Object
>
doInCallableStatement
(
final
CallableStatement
cs
)
throws
SQLException
,
DataAccessException
{
List
<
Object
>
datas
=
new
ArrayList
<
Object
>();
cs
.
execute
();
while
(
true
)
{
Integer
count
=
cs
.
getUpdateCount
();
ResultSet
resultSet
=
cs
.
getResultSet
();
if
(
count
==
-
1
&&
resultSet
==
null
)
{
break
;
}
else
{
if
(
resultSet
!=
null
)
{
datas
.
add
(
JUtil
.
resultSetToList
(
resultSet
));
}
else
{
datas
.
add
(
count
);
}
cs
.
getMoreResults
();
}
}
Map
<
Integer
,
Object
>
outMap
=
new
HashMap
<
Integer
,
Object
>();
datas
.
add
(
outMap
);
if
(
out
!=
null
&&
out
.
size
()
>
0
)
{
for
(
Integer
key:
out
.
keySet
())
{
outMap
.
put
(
key
,
cs
.
getObject
(
key
));
}
}
return
datas
;
}
});
}
public
synchronized
String
getNumber
(
String
...
args
)
{
public
synchronized
String
getNumber
(
String
...
args
)
{
String
sKey
=
null
;
String
sKey
=
null
;
String
format
=
null
;
String
format
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment