Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
elexis-3-core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
elexis
elexis-3-core
Commits
b1e1cd7a
Commit
b1e1cd7a
authored
Sep 24, 2019
by
Marco Descher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[16457] Fix trace by using prepared statement
parent
437fa1cf
Pipeline
#11236
passed with stages
in 2 minutes and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
bundles/ch.elexis.core.data/src/ch/elexis/data/Trace.java
bundles/ch.elexis.core.data/src/ch/elexis/data/Trace.java
+16
-7
No files found.
bundles/ch.elexis.core.data/src/ch/elexis/data/Trace.java
View file @
b1e1cd7a
package
ch.elexis.data
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.LoggerFactory
;
import
ch.elexis.core.data.events.ElexisEventDispatcher
;
import
ch.rgw.tools.JdbcLink
;
import
ch.rgw.tools.JdbcLink.Stm
;
import
ch.rgw.tools.net.NetTool
;
/**
...
...
@@ -32,14 +35,20 @@ public class Trace {
String
_action
=
(
StringUtils
.
isEmpty
(
action
))
?
""
:
action
;
JdbcLink
connection
=
PersistentObject
.
getConnection
();
Stm
statement
=
connection
.
getStatement
();
String
insertStatement
=
"INSERT INTO "
+
TABLENAME
+
" VALUES(?, ?, ?, ?)"
;
PreparedStatement
statement
=
connection
.
getPreparedStatement
(
insertStatement
);
try
{
statement
.
exec
(
"INSERT INTO "
+
TABLENAME
+
" VALUES("
+
Long
.
toString
(
System
.
currentTimeMillis
())
+
", "
+
connection
.
wrapFlavored
(
_workstation
)
+
", "
+
connection
.
wrapFlavored
(
_username
)
+
", "
+
connection
.
wrapFlavored
(
_action
)
+
")"
);
statement
.
setString
(
1
,
Long
.
toString
(
System
.
currentTimeMillis
()));
statement
.
setString
(
2
,
_workstation
);
statement
.
setString
(
3
,
_username
);
statement
.
setString
(
4
,
_action
);
statement
.
execute
();
}
catch
(
SQLException
e
)
{
LoggerFactory
.
getLogger
(
Trace
.
class
).
error
(
"Catched this - FIX IT"
,
e
);
}
finally
{
connection
.
releaseStatement
(
statement
);
connection
.
release
Prepared
Statement
(
statement
);
}
}
...
...
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