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
6fdcbce1
Commit
6fdcbce1
authored
May 21, 2018
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(DBServer): добавил отладочную информацию
parent
fab7ad77
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
2 deletions
+81
-2
DBServer_MySQL.cc
extensions/DBServer-MySQL/DBServer_MySQL.cc
+19
-0
DBServer_MySQL.h
extensions/DBServer-MySQL/DBServer_MySQL.h
+1
-1
DBServer_PostgreSQL.cc
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
+25
-0
DBServer_PostgreSQL.h
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.h
+1
-0
Makefile.am
extensions/DBServer-PostgreSQL/Makefile.am
+2
-0
DBServer_SQLite.cc
extensions/DBServer-SQLite/DBServer_SQLite.cc
+19
-0
DBServer_SQLite.h
extensions/DBServer-SQLite/DBServer_SQLite.h
+1
-0
DBServer.h
include/DBServer.h
+4
-1
DBServer.cc
src/Services/DBServer.cc
+9
-0
No files found.
extensions/DBServer-MySQL/DBServer_MySQL.cc
View file @
6fdcbce1
...
@@ -427,3 +427,22 @@ void DBServer_MySQL::help_print( int argc, const char* const* argv )
...
@@ -427,3 +427,22 @@ void DBServer_MySQL::help_print( int argc, const char* const* argv )
cout
<<
DBServer
::
help_print
()
<<
endl
;
cout
<<
DBServer
::
help_print
()
<<
endl
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
std
::
string
DBServer_MySQL
::
getMonitInfo
(
const
std
::
string
&
params
)
{
ostringstream
inf
;
inf
<<
"Database: "
<<
"[ ping="
<<
PingTime
<<
" reconnect="
<<
ReconnectTime
<<
" qbufSize="
<<
qbufSize
<<
" ]"
<<
endl
<<
" connection: "
<<
(
connect_ok
?
"OK"
:
"FAILED"
)
<<
endl
;
{
uniset_rwmutex_rlock
lock
(
mqbuf
);
inf
<<
" buffer size: "
<<
qbuf
.
size
()
<<
endl
;
}
inf
<<
" lastError: "
<<
db
->
error
()
<<
endl
;
return
inf
.
str
();
}
// -----------------------------------------------------------------------------
extensions/DBServer-MySQL/DBServer_MySQL.h
View file @
6fdcbce1
...
@@ -168,6 +168,7 @@ namespace uniset
...
@@ -168,6 +168,7 @@ namespace uniset
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
)
override
;
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
;
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
override
;
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
override
;
virtual
std
::
string
getMonitInfo
(
const
std
::
string
&
params
)
override
;
bool
writeToBase
(
const
std
::
string
&
query
);
bool
writeToBase
(
const
std
::
string
&
query
);
void
createTables
(
MySQLInterface
*
db
);
void
createTables
(
MySQLInterface
*
db
);
...
@@ -184,7 +185,6 @@ namespace uniset
...
@@ -184,7 +185,6 @@ namespace uniset
lastNumberOfTimer
lastNumberOfTimer
};
};
std
::
unique_ptr
<
MySQLInterface
>
db
;
std
::
unique_ptr
<
MySQLInterface
>
db
;
int
PingTime
=
{
15000
};
int
PingTime
=
{
15000
};
int
ReconnectTime
=
{
30000
};
int
ReconnectTime
=
{
30000
};
...
...
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
View file @
6fdcbce1
...
@@ -464,6 +464,31 @@ bool DBServer_PostgreSQL::deactivateObject()
...
@@ -464,6 +464,31 @@ bool DBServer_PostgreSQL::deactivateObject()
return
DBServer
::
deactivateObject
();
return
DBServer
::
deactivateObject
();
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
string
DBServer_PostgreSQL
::
getMonitInfo
(
const
string
&
params
)
{
ostringstream
inf
;
inf
<<
"Database: "
<<
"[ ping="
<<
PingTime
<<
" reconnect="
<<
ReconnectTime
<<
" qbufSize="
<<
qbufSize
<<
" ]"
<<
endl
<<
" connection: "
<<
(
connect_ok
?
"OK"
:
"FAILED"
)
<<
endl
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mqbuf
);
inf
<<
" buffer size: "
<<
qbuf
.
size
()
<<
endl
;
}
inf
<<
" lastError: "
<<
db
->
error
()
<<
endl
;
inf
<<
"Insert buffer: "
<<
"[ ibufMaxSize="
<<
ibufMaxSize
<<
" ibufSize="
<<
ibufSize
<<
" ibufSyncTimeout="
<<
ibufSyncTimeout
<<
" ]"
<<
endl
;
return
inf
.
str
();
}
//--------------------------------------------------------------------------------------------
std
::
shared_ptr
<
DBServer_PostgreSQL
>
DBServer_PostgreSQL
::
init_dbserver
(
int
argc
,
const
char
*
const
*
argv
,
std
::
shared_ptr
<
DBServer_PostgreSQL
>
DBServer_PostgreSQL
::
init_dbserver
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
&
prefix
)
const
std
::
string
&
prefix
)
{
{
...
...
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.h
View file @
6fdcbce1
...
@@ -86,6 +86,7 @@ namespace uniset
...
@@ -86,6 +86,7 @@ namespace uniset
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
;
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
override
;
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
override
;
virtual
bool
deactivateObject
()
override
;
virtual
bool
deactivateObject
()
override
;
virtual
std
::
string
getMonitInfo
(
const
std
::
string
&
params
)
override
;
bool
writeToBase
(
const
std
::
string
&
query
);
bool
writeToBase
(
const
std
::
string
&
query
);
void
createTables
(
std
::
shared_ptr
<
PostgreSQLInterface
>&
db
);
void
createTables
(
std
::
shared_ptr
<
PostgreSQLInterface
>&
db
);
...
...
extensions/DBServer-PostgreSQL/Makefile.am
View file @
6fdcbce1
...
@@ -27,4 +27,6 @@ devel_includedir = $(includedir)/@PACKAGE@/extensions/pgsql
...
@@ -27,4 +27,6 @@ devel_includedir = $(includedir)/@PACKAGE@/extensions/pgsql
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfig_DATA
=
libUniSet2PostgreSQL.pc
pkgconfig_DATA
=
libUniSet2PostgreSQL.pc
include
$(top_builddir)/include.mk
endif
endif
extensions/DBServer-SQLite/DBServer_SQLite.cc
View file @
6fdcbce1
...
@@ -401,3 +401,22 @@ void DBServer_SQLite::help_print( int argc, const char* const* argv )
...
@@ -401,3 +401,22 @@ void DBServer_SQLite::help_print( int argc, const char* const* argv )
cout
<<
DBServer
::
help_print
()
<<
endl
;
cout
<<
DBServer
::
help_print
()
<<
endl
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
std
::
string
DBServer_SQLite
::
getMonitInfo
(
const
std
::
string
&
params
)
{
ostringstream
inf
;
inf
<<
"Database: "
<<
"[ ping="
<<
PingTime
<<
" reconnect="
<<
ReconnectTime
<<
" qbufSize="
<<
qbufSize
<<
" ]"
<<
endl
<<
" connection: "
<<
(
connect_ok
?
"OK"
:
"FAILED"
)
<<
endl
;
{
uniset_rwmutex_rlock
lock
(
mqbuf
);
inf
<<
" buffer size: "
<<
qbuf
.
size
()
<<
endl
;
}
inf
<<
" lastError: "
<<
db
->
error
()
<<
endl
;
return
inf
.
str
();
}
// -----------------------------------------------------------------------------
extensions/DBServer-SQLite/DBServer_SQLite.h
View file @
6fdcbce1
...
@@ -168,6 +168,7 @@ namespace uniset
...
@@ -168,6 +168,7 @@ namespace uniset
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
)
override
;
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
;
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
override
;
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
override
;
virtual
std
::
string
getMonitInfo
(
const
std
::
string
&
params
)
override
;
bool
writeToBase
(
const
std
::
string
&
query
);
bool
writeToBase
(
const
std
::
string
&
query
);
void
createTables
(
SQLiteInterface
*
db
);
void
createTables
(
SQLiteInterface
*
db
);
...
...
include/DBServer.h
View file @
6fdcbce1
...
@@ -58,6 +58,8 @@ namespace uniset
...
@@ -58,6 +58,8 @@ namespace uniset
static
std
::
string
help_print
();
static
std
::
string
help_print
();
virtual
uniset
::
SimpleInfo
*
getInfo
(
const
char
*
userparam
=
""
)
override
;
protected
:
protected
:
virtual
void
processingMessage
(
const
uniset
::
VoidMessage
*
msg
)
override
;
virtual
void
processingMessage
(
const
uniset
::
VoidMessage
*
msg
)
override
;
...
@@ -65,7 +67,8 @@ namespace uniset
...
@@ -65,7 +67,8 @@ namespace uniset
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
{}
virtual
void
confirmInfo
(
const
uniset
::
ConfirmMessage
*
cmsg
)
{}
virtual
bool
activateObject
()
override
;
virtual
bool
activateObject
()
override
;
virtual
void
initDBServer
()
{};
virtual
void
initDBServer
()
{}
virtual
std
::
string
getMonitInfo
(
const
std
::
string
&
params
){
return
""
;
}
std
::
shared_ptr
<
LogAgregator
>
loga
;
std
::
shared_ptr
<
LogAgregator
>
loga
;
...
...
src/Services/DBServer.cc
View file @
6fdcbce1
...
@@ -141,3 +141,12 @@ std::string DBServer::help_print()
...
@@ -141,3 +141,12 @@ std::string DBServer::help_print()
return
h
.
str
();
return
h
.
str
();
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
SimpleInfo
*
DBServer
::
getInfo
(
const
char
*
userparam
)
{
uniset
::
SimpleInfo_var
i
=
UniSetObject
::
getInfo
(
userparam
);
const
std
::
string
inf
=
getMonitInfo
(
std
::
string
(
userparam
)
);
i
->
info
=
inf
.
c_str
();
return
i
.
_retn
();
}
//--------------------------------------------------------------------------------------------
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