summaryrefslogtreecommitdiff
path: root/libopie2/opiedb/osqldriver.h
blob: 492b8dda66d91389c632c6e854f3d0dc55eebb85 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef OSQL_DRIVER_H
#define OSQL_DRIVER_H

#include <qobject.h>
#include <qstring.h>

#include "osqltable.h"

class QLibrary;

namespace Opie {
namespace DB {

class OSQLResult;
class OSQLQuery;
class OSQLError;

/**
 * A OSQLDriver implements the communication with
 * a database.
 * After you queried and loaded a driver you can
 * set some informations and finally try to open
 * the database
 *
 */
class OSQLDriver : public QObject{
    Q_OBJECT
public:
    enum Capabilities { RowID=0 };
    /**
     * OSQLDriver constructor. It takes the QLibrary
     * as parent.
     *
     */
    OSQLDriver( QLibrary* lib=0 );

    virtual ~OSQLDriver();
    /**
     * Id returns the identifier of the OSQLDriver
     */
    virtual QString id()const = 0;

    /**
     * set the UserName to the database
     */
    virtual void setUserName( const QString& ) = 0;

    /**
     * set the PassWord to the database
     */
    virtual void setPassword( const QString& )= 0;

    /**
     * set the Url
     */
    virtual void setUrl( const QString& ) = 0;

    /**
     * setOptions
     */
    virtual void setOptions( const QStringList& ) = 0;

    /**
     * tries to open a connection to the database
     */
    virtual bool open() = 0;
    virtual bool close() = 0;

    virtual OSQLError lastError() = 0;

    /**
     * Query the Database with a OSQLQuery
     * OSQLResult holds the result
     */
    virtual OSQLResult query( OSQLQuery* ) = 0;

    /**
     * Get a list of tables
     */
    virtual OSQLTable::ValueList tables() const = 0l;
    virtual bool sync();


private:
    QLibrary* m_lib;
    class OSQLDriverPrivate;
    OSQLDriverPrivate *d;

};

}
}

#endif