WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
Public Slots | Public Member Functions | Static Public Member Functions | Protected Attributes | Properties | List of all members
Zbl::ZblDatabase Class Reference

This class allows QSqlDatabase objects to be accessed directly from QML code. (database sprocket) More...

#include <ZblDatabase.h>

Inheritance diagram for Zbl::ZblDatabase:
Inheritance graph
[legend]
Collaboration diagram for Zbl::ZblDatabase:
Collaboration graph
[legend]

Public Slots

void removeThreadDatabases ()
 Removes all databases that belong to the current thread. More...
 

Public Member Functions

 ZblDatabase (QObject *parent=0)
 
 ~ZblDatabase ()
 
QString getText ()
 
void setText (const QString &text)
 
Q_INVOKABLE QObject * sqlAddDatabase (const QString &driverType, const QString &connectionName)
 Adds a SQL database to the list of database connections. If a connection of the same name exists it is replaced with a new connection. More...
 
Q_INVOKABLE QObject * sqlGetDatabase (const QString &connectionName)
 Obtains a SQL database from the list of database connections. The named connection must have previously been created by a call to ZblApp::sqlAddDatabase(). More...
 
Q_INVOKABLE void sqlRemoveDatabase (const QString &connectionName)
 Removes a SQL database from the list of database connections. More...
 
Q_INVOKABLE QStringList sqlGetConnectionNames ()
 Obtains the names of SQL database connections. More...
 
Q_INVOKABLE bool sqlContainsConnection (const QString &connectionName)
 Determines if a named SQL database connection exists. More...
 
Q_INVOKABLE bool sqlIsDriverAvailable (const QString &driverName)
 Determines if a named SQL database driver is available. More...
 

Static Public Member Functions

static void registerType ()
 Registers ZblDatabase as a QML type. More...
 
static QObject * newObject (QObject *parent)
 Sprocket object constructor for creating ZblDatabase objects in javascript background threads. More...
 

Protected Attributes

ZBL_DECLARE_LOGGED_OBJECT QString m_text
 

Properties

QString text
 

Detailed Description

This class allows QSqlDatabase objects to be accessed directly from QML code. (database sprocket)

See also
Zbl::ZsqlDatabase

Definition at line 17 of file ZblDatabase.h.

Constructor & Destructor Documentation

◆ ZblDatabase()

Zbl::ZblDatabase::ZblDatabase ( QObject *  parent = 0)

Definition at line 12 of file ZblDatabase.cpp.

Referenced by newObject().

◆ ~ZblDatabase()

Zbl::ZblDatabase::~ZblDatabase ( )

Definition at line 22 of file ZblDatabase.cpp.

Member Function Documentation

◆ getText()

QString Zbl::ZblDatabase::getText ( )

Definition at line 46 of file ZblDatabase.cpp.

◆ newObject()

QObject * Zbl::ZblDatabase::newObject ( QObject *  parent)
static

Sprocket object constructor for creating ZblDatabase objects in javascript background threads.

Parameters
parentset to parent QObject or NULL for ZblDatabase to have no parent.
Returns
The newly constructed ZblDatabase object.

Definition at line 37 of file ZblDatabase.cpp.

Referenced by registerType().

◆ registerType()

void Zbl::ZblDatabase::registerType ( )
static

Registers ZblDatabase as a QML type.

Definition at line 27 of file ZblDatabase.cpp.

◆ removeThreadDatabases

void Zbl::ZblDatabase::removeThreadDatabases ( )
slot

Removes all databases that belong to the current thread.

◆ setText()

void Zbl::ZblDatabase::setText ( const QString &  text)

Definition at line 51 of file ZblDatabase.cpp.

◆ sqlAddDatabase()

QObject * Zbl::ZblDatabase::sqlAddDatabase ( const QString &  driverType,
const QString &  connectionName 
)

Adds a SQL database to the list of database connections. If a connection of the same name exists it is replaced with a new connection.

Parameters
driverTypea database driver type to use for the connection
connectionNamea name for the connection
Returns
A ZsqlDatabase object that can be used to access the database

Definition at line 57 of file ZblDatabase.cpp.

◆ sqlContainsConnection()

bool Zbl::ZblDatabase::sqlContainsConnection ( const QString &  connectionName)

Determines if a named SQL database connection exists.

Parameters
connectionNamename of the connection to test
Returns
true if specified connection exists, false otherwise

Definition at line 86 of file ZblDatabase.cpp.

◆ sqlGetConnectionNames()

QStringList Zbl::ZblDatabase::sqlGetConnectionNames ( )

Obtains the names of SQL database connections.

Returns
a list of database connection names

Definition at line 79 of file ZblDatabase.cpp.

◆ sqlGetDatabase()

QObject * Zbl::ZblDatabase::sqlGetDatabase ( const QString &  connectionName)

Obtains a SQL database from the list of database connections. The named connection must have previously been created by a call to ZblApp::sqlAddDatabase().

Parameters
driverTypea database driver type to use for the connection
connectionNamea name for the connection
Returns
A ZsqlDatabase object that can be used to access the database

Definition at line 72 of file ZblDatabase.cpp.

◆ sqlIsDriverAvailable()

bool Zbl::ZblDatabase::sqlIsDriverAvailable ( const QString &  driverName)

Determines if a named SQL database driver is available.

Parameters
driverNamename of the driver to test
Returns
true if specified driver exists, false otherwise

Definition at line 93 of file ZblDatabase.cpp.

◆ sqlRemoveDatabase()

void Zbl::ZblDatabase::sqlRemoveDatabase ( const QString &  connectionName)

Removes a SQL database from the list of database connections.

Warning: There should be no open queries on the database connection when this function is called, otherwise a resource leak will occur.

Parameters
connectionNamename of the connection to remove

Definition at line 65 of file ZblDatabase.cpp.

Member Data Documentation

◆ m_text

ZBL_DECLARE_LOGGED_OBJECT QString Zbl::ZblDatabase::m_text
protected

Definition at line 123 of file ZblDatabase.h.

Referenced by getText(), and setText().

Property Documentation

◆ text

QString Zbl::ZblDatabase::text
readwrite

Definition at line 34 of file ZblDatabase.h.

Referenced by setText().


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