Новое начало
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
#pragma db object
|
||||
class Author {
|
||||
public:
|
||||
Author() = default;
|
||||
Author(const std::string& name) : name(name) {}
|
||||
|
||||
const std::string& getName() const { return name; }
|
||||
|
||||
private:
|
||||
#pragma db id auto
|
||||
int id;
|
||||
std::string name;
|
||||
};
|
||||
22
src/book.hpp
22
src/book.hpp
@@ -1,22 +0,0 @@
|
||||
#pragma db object
|
||||
class Book {
|
||||
public:
|
||||
Book() = default;
|
||||
Book(const std::string& title, const std::string& author, const std::string& filePath,
|
||||
int fileSize, const std::string& format);
|
||||
|
||||
const std::string& getTitle() const { return title; }
|
||||
const std::string& getAuthor() const { return author; }
|
||||
const std::string& getFilePath() const { return filePath; }
|
||||
int getFileSize() const { return fileSize; }
|
||||
const std::string& getFormat() const { return format; }
|
||||
|
||||
private:
|
||||
#pragma db id auto
|
||||
int id;
|
||||
std::string title;
|
||||
std::string author;
|
||||
std::string filePath;
|
||||
int fileSize;
|
||||
std::string format;
|
||||
};
|
||||
@@ -1,13 +0,0 @@
|
||||
#include "database.h"
|
||||
#include <odb/sqlite/database.hxx>
|
||||
#include <odb/schema-catalog.hxx>
|
||||
#include "book-odb.hxx"
|
||||
#include "author-odb.hxx"
|
||||
|
||||
std::unique_ptr<odb::sqlite::database> initializeDatabase(const std::string& dbPath) {
|
||||
auto db = std::make_unique<odb::sqlite::database>(dbPath, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
|
||||
odb::transaction t(db->begin());
|
||||
odb::schema_catalog::create_schema(*db);
|
||||
t.commit();
|
||||
return db;
|
||||
}
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -1,12 +0,0 @@
|
||||
#include <QCoreApplication>
|
||||
#include "backend.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
Backend backend;
|
||||
backend.start();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user