Commit 86c45bc2 authored by Pavel Vainerman's avatar Pavel Vainerman

minor fixes in UHelper.h

parent 486df15e
......@@ -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