Разнос по библиотекам + прикручиваем odb из redkitty
This commit was merged in pull request #5.
This commit is contained in:
64
src/database/book_s.h
Normal file
64
src/database/book_s.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// file : hello/person.hxx
|
||||
// copyright : not copyrighted - public domain
|
||||
|
||||
#ifndef BOOK_S_H
|
||||
#define BOOK_S_H
|
||||
|
||||
#include "database_global.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <odb/core.hxx>
|
||||
#include <rcore/smarttypes.h>
|
||||
|
||||
#include "author_s.h"
|
||||
|
||||
#pragma db object
|
||||
class DATABASE_EXPORT Book_S
|
||||
{
|
||||
public:
|
||||
Book_S() = default;
|
||||
|
||||
Book_S(const QString& name,
|
||||
const SH<Author_S>& author,
|
||||
const int year)
|
||||
{
|
||||
m_author = author;
|
||||
m_name = name;
|
||||
m_year = year;
|
||||
};
|
||||
|
||||
unsigned long long id() const { return m_id; }
|
||||
SH<Author_S> author() const { return m_author; }
|
||||
QString name() const { return m_name; }
|
||||
int year() const { return m_year; }
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
|
||||
private:
|
||||
#pragma db id auto
|
||||
quint64 m_id;
|
||||
|
||||
SH<Author_S> m_author;
|
||||
QString m_name;
|
||||
quint8 m_year;
|
||||
};
|
||||
|
||||
// #pragma db view object(Book_S) object(Author_S = author:Book_S::m_author)
|
||||
// struct BookByAuthorView
|
||||
// {
|
||||
// #pragma db column(Book_S::m_id)
|
||||
// quint64 book_id;
|
||||
|
||||
// #pragma db column(Book_S::m_name)
|
||||
// QString book_name;
|
||||
|
||||
// #pragma db column(Book_S::m_year)
|
||||
// qint8 year;
|
||||
|
||||
// #pragma db column(Author_S::m_first + " " + Author_S::m_last)
|
||||
// QString author_full_name;
|
||||
// };
|
||||
|
||||
#endif // BOOK_S_H
|
||||
Reference in New Issue
Block a user