MyBooks
Public Member Functions | Properties | Private Attributes | List of all members
Books Class Reference

#include <books.hpp>

Inheritance diagram for Books:
Inheritance graph
[legend]
Collaboration diagram for Books:
Collaboration graph
[legend]

Public Member Functions

 Books (QObject *parent=0)
 
 ~Books ()
 
quint32 getLastErr ()
 
QString getLastErrMsg ()
 
bool save (BooksRecord rec)
 
bool del (BooksRecord rec)
 
bool update (BooksRecord rec)
 
quint32 findLastID ()
 
BooksRecord findBooksRecord (BooksRecord rec)
 
QSqlQuery findBookTitle (QString title)
 
QSqlQuery findAll ()
 
QSqlQuery findAllBooksByAuth (int id)
 
QSqlQuery findID (quint32 id)
 
QSqlQuery findAllBooksByTitle ()
 
QSqlQuery findAllBooksByAuthor (QString auth)
 
QSqlQuery findAllBooksGrpAuth (QString auth)
 
BooksRecord getBooksRec (int id)
 
bool dupchk (BooksRecord *rec)
 

Properties

quint32 err
 
QString errmsg
 

Private Attributes

QSqlDatabase db
 

Detailed Description

Constructs a database interface to the Books table. The implementation of the interface to the Books table in the database provides a wrapper around the SQL functions needed to access and maintain records in the Books table of the database. Implementation is the same no matter what database server is used.

Database access is provided by public methods:

bool:save(BooksRecord rec)
bool:del(BooksRecord rec)
bool:update(BooksRecord rec)
bool:findBooksID(BooksRecord rec)
bool:findAuthorName(QString strCall)(int id)
QSqlQuery:findAll()
QSqlQuery:findID(quint32 id)
QSqlQuery:findBooks(QString callstr)

Parameters
QObject*parent

Constructor & Destructor Documentation

◆ Books()

Books::Books ( QObject *  parent = 0)
explicit

◆ ~Books()

Books::~Books ( )

Member Function Documentation

◆ del()

bool Books::del ( BooksRecord  rec)

  bool del(BooksRecord rec)

SQL function to delete a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool Success - returns true

◆ dupchk()

bool Books::dupchk ( BooksRecord rec)

SQL query searches the database with BooksRecord for data to match the title, author, and media. This is a custom interface function to perform SQL database functions regardless of what type of database is used.

Returns
BOOL - Success returns TRUE if duplicate found - falure returns FALSE

◆ findAll()

QSqlQuery Books::findAll ( )

SQL query returning all rows in the table. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows - falure returns null

◆ findAllBooksByAuth()

QSqlQuery Books::findAllBooksByAuth ( int  id)

SQL query returning all rows in the table for a given author. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows. Falure returns invalid query

◆ findAllBooksByAuthor()

QSqlQuery Books::findAllBooksByAuthor ( QString  auth)

SQL query returns SQL query result of rows that match the author ID. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows - falure returns null

◆ findAllBooksByTitle()

QSqlQuery Books::findAllBooksByTitle ( )

SQL query returns SQL query result of rows that match the pattern in strTitle. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows - falure returns null

◆ findAllBooksGrpAuth()

QSqlQuery Books::findAllBooksGrpAuth ( QString  auth)

SQL query returns a relational SQL query result of all rows grouped by author LastName and FirstName. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of all rows - falure returns null

◆ findBooksRecord()

BooksRecord Books::findBooksRecord ( BooksRecord  rec)

SQL function returns true if author is found for a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true

◆ findBookTitle()

QSqlQuery Books::findBookTitle ( QString  title)

SQL function returns true if author is found for a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true if author specific first and last name exists

◆ findID()

QSqlQuery Books::findID ( quint32  id)

SQL query returns SQL query result of one row with id. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
QSqlQuery - Success returns QSqlQuery result of rows with ID - falure returns null

◆ findLastID()

quint32 Books::findLastID ( )

SQL function returns the highest value of ID for all author records. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
unsigned long - Success returns true

◆ getBooksRec()

BooksRecord Books::getBooksRec ( int  id)

SQL query returns a BooksRecord with data to match the author in strcall. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
BooksRecord - Success returns BooksRecord result - falure returns empty record

◆ getLastErr()

quint32 Books::getLastErr ( )
inline

◆ getLastErrMsg()

QString Books::getLastErrMsg ( )
inline
Here is the call graph for this function:

◆ save()

bool Books::save ( BooksRecord  rec)

SQL function to save author record. This is an interface functiont to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true

◆ update()

bool Books::update ( BooksRecord  rec)

SQL function to update a specific author record. This is an interface function to perform SQL database functions regardless of what type of database is used.

Returns
bool - Success returns true

Member Data Documentation

◆ db

QSqlDatabase Books::db
private

Property Documentation

◆ err

quint32 Books::err
read

This property holds the last error number to be returned.

The number will be returned from the database table handler upon last action.

The default value of this property is QSqlDatabase::NoError (0).

Access functions:

  QString getLastErr()

◆ errmsg

QString Books::errmsg
read

This property holds the message text to be displayed.

The text will be returned from the database table handler upon last action.

The default value of this property is an empty string.

Access functions:

  QString getLastErrMsg()

The documentation for this class was generated from the following files: