/*
*openPilot Log - A FOSS Pilot Logbook Application
*Copyright (C) 2020 Felix Turowsky
*
*This program is free software: you can redistribute it and/or modify
*it under the terms of the GNU General Public License as published by
*the Free Software Foundation, either version 3 of the License, or
*(at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program. If not, see .
*/
#ifndef ENTRY1_H
#define ENTRY1_H
#include
#include "db.h"
#include "dbinfo.h"
/*!
* \brief The Entry class is the base class for database entries.
* It can be seen as a row in a table within the database.
*
*/
class Entry_deprecated
{
public:
Entry_deprecated();
Entry_deprecated(QString table, int row);
Entry_deprecated(QString table, QMap newData);
QPair position = QPair(); // Position within the database, i.e.
QVector columns = QVector(); // The columns within the table
QMap data = QMap(); // Tha data to fill that table,
QString error = QString(); // holds sql errors (if they ocurred)
void setData(QMap &value);
bool commit();
bool remove();
bool exists();
// Debug functionality
void print();
QString debug();
operator QString()
{
return debug(); //overload for compatibility with qDebug()
}
private:
bool insert();
bool update();
};
#endif // ENTRY_H