Commit 18fee0c4 authored by Pavel Vainerman's avatar Pavel Vainerman

minor fixes in UHelper.h

parent 0f8bf497
......@@ -19,7 +19,7 @@
Name: libuniset2
Version: 2.7
Release: alt10
Release: alt11
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
......@@ -540,6 +540,9 @@ rm -f %buildroot%_libdir/*.la
# history of current unpublished changes
%changelog
* Sat Jun 09 2018 Pavel Vainerman <pv@altlinux.ru> 2.7-alt11
- PostgreSQL: extended the interface
* Thu May 24 2018 Pavel Vainerman <pv@altlinux.ru> 2.7-alt10
- fix pack opentsdb backend
......
......@@ -222,7 +222,7 @@ void DBServer_PostgreSQL::flushInsertBuffer()
dbinfo << myname << "(flushInsertBuffer): write insert buffer[" << ibufSize << "] to DB.." << endl;
if( !db->copy("main_history", tblcols, ibuf) )
if( !writeBufferToDB("main_history", tblcols, ibuf) )
{
dbcrit << myname << "(flushInsertBuffer): error: " << db->error() << endl;
}
......@@ -233,6 +233,13 @@ void DBServer_PostgreSQL::flushInsertBuffer()
}
}
//--------------------------------------------------------------------------------------------
bool DBServer_PostgreSQL::writeBufferToDB( const std::string& tableName
, const std::vector<std::string>& colNames
, DBServer_PostgreSQL::InsertBuffer& wbuf )
{
return db->copy(tableName, colNames, wbuf);
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::sensorInfo( const uniset::SensorMessage* si )
{
try
......
......@@ -129,6 +129,10 @@ namespace uniset
size_t ibufMaxSize = { 2000 };
timeout_t ibufSyncTimeout = { 15000 };
void flushInsertBuffer();
virtual bool writeBufferToDB( const std::string& table
, const std::vector<std::string>& colname
, InsertBuffer& ibuf );
float ibufOverflowCleanFactor = { 0.5 }; // коэфициент {0...1} чистки буфера при переполнении
private:
......
......@@ -18,6 +18,7 @@
#define UHelpers_H_
// --------------------------------------------------------------------------
#include "UniSetTypes.h"
#include "Exceptions.h"
#include "Configuration.h"
// --------------------------------------------------------------------------
namespace uniset
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment