58 lines
1022 B
C++
Executable File
58 lines
1022 B
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010-2012, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_plugins_ticket_tdb
|
|
#define headerfile_winix_plugins_ticket_tdb
|
|
|
|
|
|
#include <vector>
|
|
#include "ticket.h"
|
|
#include "db/dbbase.h"
|
|
#include "core/error.h"
|
|
|
|
|
|
namespace Ticket
|
|
{
|
|
|
|
|
|
class TDb : public DbBase
|
|
{
|
|
public:
|
|
|
|
bool IsTicket(long file_id);
|
|
Error GetTicket(long file_id, Ticket & ticket);
|
|
Error GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket> & ticket_tab, bool clear_tab = true);
|
|
Error AddTicket(const Ticket & ticket);
|
|
Error RemoveAddTicket(const Ticket & ticket); // first removing and then adding a ticket
|
|
Error RemoveTicket(long file_id);
|
|
|
|
|
|
private:
|
|
|
|
DbTextStream query;
|
|
Ticket empty_ticket;
|
|
Ticket::TicketParam tic_par;
|
|
|
|
int cfileid;
|
|
int cparam;
|
|
int cintv;
|
|
int cdecv;
|
|
|
|
void SetTicketColumns(PGresult * r);
|
|
void ReadTicketPar(PGresult * r, Ticket::TicketParam & par, int row);
|
|
|
|
};
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
#endif
|
|
|