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
ZblDatabase.h
Go to the documentation of this file.
1 #ifndef ZBLDATABASE_H
2 #define ZBLDATABASE_H
3 
4 #include <QObject>
5 #include <QStringList>
6 #include "zglobal.h"
7 
8 namespace Zbl
9 {
17 class ZblDatabase : public QObject
18 {
19  Q_OBJECT
20  Q_DISABLE_COPY(ZblDatabase)
21 
22 public:
23  ZblDatabase(QObject *parent = 0);
24  ~ZblDatabase();
25 
30  static void registerType();
31 
32 
33 
34  Q_PROPERTY(QString text READ getText WRITE setText)
35 
36  QString getText();
37  void setText(const QString& text);
38 
48  static QObject* newObject(QObject* parent);
49 
58  Q_INVOKABLE QObject* sqlAddDatabase(const QString& driverType,
59  const QString& connectionName );
60 
70  Q_INVOKABLE QObject* sqlGetDatabase(const QString& connectionName );
71 
81  Q_INVOKABLE void sqlRemoveDatabase(const QString& connectionName);
82 
89  Q_INVOKABLE QStringList sqlGetConnectionNames();
90 
99  Q_INVOKABLE bool sqlContainsConnection(const QString& connectionName);
100 
109  Q_INVOKABLE bool sqlIsDriverAvailable(const QString& driverName);
110 
111 public slots:
112 
117  void removeThreadDatabases();
118 
119 protected:
120 
122 
123  QString m_text;
124 
125 
126 };
127 
128 } // Zbl
129 
130 #endif // ZBLDATABASE_H
131 
This class allows QSqlDatabase objects to be accessed directly from QML code. (database sprocket) ...
Definition: ZblDatabase.h:17
static QObject * newObject(QObject *parent)
Sprocket object constructor for creating ZblDatabase objects in javascript background threads...
Definition: ZblDatabase.cpp:37
Q_INVOKABLE QStringList sqlGetConnectionNames()
Obtains the names of SQL database connections.
Definition: ZblDatabase.cpp:79
#define ZBL_DECLARE_LOGGED_OBJECT
Definition: zglobal.h:94
QString getText()
Definition: ZblDatabase.cpp:46
Q_INVOKABLE QObject * sqlGetDatabase(const QString &connectionName)
Obtains a SQL database from the list of database connections. The named connection must have previous...
Definition: ZblDatabase.cpp:72
Q_INVOKABLE void sqlRemoveDatabase(const QString &connectionName)
Removes a SQL database from the list of database connections.
Definition: ZblDatabase.cpp:65
Definition: ZAndGate.cpp:6
Q_INVOKABLE bool sqlContainsConnection(const QString &connectionName)
Determines if a named SQL database connection exists.
Definition: ZblDatabase.cpp:86
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 i...
Definition: ZblDatabase.cpp:57
void setText(const QString &text)
Definition: ZblDatabase.cpp:51
Q_INVOKABLE bool sqlIsDriverAvailable(const QString &driverName)
Determines if a named SQL database driver is available.
Definition: ZblDatabase.cpp:93
ZblDatabase(QObject *parent=0)
Definition: ZblDatabase.cpp:12
static void registerType()
Registers ZblDatabase as a QML type.
Definition: ZblDatabase.cpp:27
void removeThreadDatabases()
Removes all databases that belong to the current thread.
ZBL_DECLARE_LOGGED_OBJECT QString m_text
Definition: ZblDatabase.h:123