Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
962bc54b
Commit
962bc54b
authored
Nov 21, 2012
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(DBServer): исправления к предыдущему коммиту (новй ConfirmMessage)
parent
2f43cde2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
DBServer_MySQL.cc
extensions/DBServer-MySQL/DBServer_MySQL.cc
+30
-18
No files found.
extensions/DBServer-MySQL/DBServer_MySQL.cc
View file @
962bc54b
...
@@ -35,7 +35,8 @@
...
@@ -35,7 +35,8 @@
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
using
namespace
std
;
using
namespace
std
;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
const
Debug
::
type
DBLEVEL
=
Debug
::
LEVEL1
;
// --------------------------------------------------------------------------
DBServer_MySQL
::
DBServer_MySQL
(
ObjectId
id
)
:
DBServer_MySQL
::
DBServer_MySQL
(
ObjectId
id
)
:
DBServer
(
id
),
DBServer
(
id
),
db
(
new
DBInterface
()),
db
(
new
DBInterface
()),
...
@@ -215,26 +216,37 @@ void DBServer_MySQL::parse( UniSetTypes::AlarmMessage* am )
...
@@ -215,26 +216,37 @@ void DBServer_MySQL::parse( UniSetTypes::AlarmMessage* am )
}
}
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
void
DBServer_MySQL
::
parse
(
UniSetTypes
::
ConfirmMessage
*
a
m
)
void
DBServer_MySQL
::
parse
(
UniSetTypes
::
ConfirmMessage
*
ce
m
)
{
{
// Сохраняем ПОДТВЕРЖДЕНИЕ в базу
try
ostringstream
query
;
{
query
<<
"UPDATE "
<<
tblName
(
am
->
orig_type
)
<<
" SET "
;
ostringstream
data
;
query
<<
"confirm='"
<<
ui
.
timeToString
(
am
->
tm
.
tv_sec
,
":"
)
<<
"'"
;
query
<<
" where "
;
query
<<
" id='"
<<
am
->
orig_id
<<
"'"
;
query
<<
" AND type='"
<<
am
->
orig_type
<<
"'"
;
query
<<
" AND node='"
<<
am
->
orig_node
<<
"'"
;
query
<<
" AND code='"
<<
am
->
code
<<
"'"
;
// query << " AND cause='" << am->cause << "'";
query
<<
" AND date='"
<<
ui
.
dateToString
(
am
->
orig_tm
.
tv_sec
,
"/"
)
<<
"'"
;
query
<<
" AND time='"
<<
ui
.
timeToString
(
am
->
orig_tm
.
tv_sec
,
":"
)
<<
"'"
;
query
<<
" AND time_usec='"
<<
am
->
orig_tm
.
tv_usec
<<
"'"
;
if
(
!
writeToBase
(
query
.
str
())
)
data
<<
"UPDATE main_history SET confirm='"
<<
cem
->
confirm
<<
"'"
;
data
<<
" WHERE sensor_id='"
<<
cem
->
sensor_id
<<
"'"
;
data
<<
" AND date='"
<<
ui
.
dateToString
(
cem
->
time
,
"-"
)
<<
" '"
;
data
<<
" AND time='"
<<
ui
.
timeToString
(
cem
->
time
,
":"
)
<<
" '"
;
data
<<
" AND time_usec='"
<<
cem
->
time_usec
<<
" '"
;
if
(
unideb
.
debugging
(
DBLEVEL
)
)
unideb
[
DBLEVEL
]
<<
myname
<<
"(update_confirm): "
<<
data
.
str
()
<<
endl
;
if
(
!
writeToBase
(
data
.
str
())
)
{
if
(
unideb
.
debugging
(
Debug
::
CRIT
)
)
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(update_confirm): db error: "
<<
db
->
error
()
<<
endl
;
db
->
freeResult
();
}
}
catch
(
Exception
&
ex
)
{
{
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(insert): confirm msg error: "
<<
db
->
error
()
<<
endl
;
if
(
unideb
.
debugging
(
Debug
::
CRIT
)
)
// db->freeResult();
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(update_confirm): "
<<
ex
<<
endl
;
}
catch
(
...
)
{
if
(
unideb
.
debugging
(
Debug
::
CRIT
)
)
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(update_confirm): catch..."
<<
endl
;
}
}
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
...
...
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