*/
/*
- * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ * Author : Maksym Mamontov <stg@madf.info>
*/
*/
#include "firebird_store.h"
-#include "ibpp.h"
+#include "stg/ibpp.h"
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::GetServicesList(vector<string> * servicesList) const
+int FIREBIRD_STORE::GetServicesList(std::vector<std::string> * servicesList) const
{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);
-string name;
+std::string name;
try
{
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::SaveService(const SERVICE_CONF & sc) const
{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);
where name = ?");
st->Set(1, sc.comment);
st->Set(2, sc.cost);
- st->Set(3, sc.payDay);
+ st->Set(3, static_cast<int16_t>(sc.payDay));
st->Set(4, sc.name);
st->Execute();
tr->Commit();
}
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::RestoreService(SERVICE_CONF * sc,
- const string & name) const
+ const std::string & name) const
{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);
{
st->Get(3, sc->comment);
st->Get(4, sc->cost);
- st->Get(5, sc->payDay);
+ int16_t pd;
+ st->Get(5, pd);
+ sc->payDay = static_cast<uint8_t>(pd);
}
else
{
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::AddService(const string & name) const
+int FIREBIRD_STORE::AddService(const std::string & name) const
{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::DelService(const string & name) const
+int FIREBIRD_STORE::DelService(const std::string & name) const
{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);