File: memdbloader.h

package info (click to toggle)
openrpt 3.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,220 kB
  • ctags: 4,263
  • sloc: cpp: 31,332; ansic: 12,175; xml: 7,401; sh: 376; sql: 32; makefile: 21
file content (37 lines) | stat: -rw-r--r-- 818 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef MEMDBLOADER_H
#define MEMDBLOADER_H

#include <QStringList>
#include <QDomElement>
#include <QSqlDatabase>

class MemDbLoader 
{
public:
    MemDbLoader();
    ~MemDbLoader();

public:

	static QString createMemoryDB(QString id="");

    // Load the DB from a file
    bool load(const QString &filename, QSqlDatabase db);
    // Load the DB from a DomElement
    bool load(const QDomElement & elemSource, QSqlDatabase db);
    QString lastError() {return _lastError;}
    
private:
    // Parse the table infos
    void parseTable(const QDomElement & elemSource);
    void parseColumns(const QDomElement & elemSource);
    void parseRecord(const QDomElement & elemSource);
    
	QSqlDatabase _db;
    QString 	_lastError;
    QString 	_tableName;
    QStringList _columnNames;
    
};

#endif // MEMDBLOADER_H