-rw-r--r-- | libsql/osqldriver.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libsql/osqldriver.h b/libsql/osqldriver.h new file mode 100644 index 0000000..68d8ee6 --- a/dev/null +++ b/libsql/osqldriver.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef OSQL_DRIVER_H | ||
2 | #define OSQL_DRIVER_H | ||
3 | |||
4 | #include <qobject.h> | ||
5 | #include <qstring.h> | ||
6 | |||
7 | #include "osqltable.h" | ||
8 | |||
9 | class QLibrary; | ||
10 | class OSQLResult; | ||
11 | class OSQLQuery; | ||
12 | class OSQLError; | ||
13 | |||
14 | /** | ||
15 | * A OSQLDriver implements the communication with | ||
16 | * a database. | ||
17 | * After you queried and loaded a driver you can | ||
18 | * set some informations and finally try to open | ||
19 | * the database | ||
20 | * | ||
21 | */ | ||
22 | class OSQLDriver : public QObject{ | ||
23 | Q_OBJECT | ||
24 | public: | ||
25 | enum Capabilities { RowID=0 }; | ||
26 | /** | ||
27 | * OSQLDriver constructor. It takes the QLibrary | ||
28 | * as parent. | ||
29 | * | ||
30 | */ | ||
31 | OSQLDriver( QLibrary* lib=0 ); | ||
32 | |||
33 | virtual ~OSQLDriver(); | ||
34 | /** | ||
35 | * Id returns the identifier of the OSQLDriver | ||
36 | */ | ||
37 | virtual QString id()const = 0; | ||
38 | |||
39 | /** | ||
40 | * set the UserName to the database | ||
41 | */ | ||
42 | virtual void setUserName( const QString& ) = 0; | ||
43 | |||
44 | /** | ||
45 | * set the PassWord to the database | ||
46 | */ | ||
47 | virtual void setPassword( const QString& )= 0; | ||
48 | |||
49 | /** | ||
50 | * set the Url | ||
51 | */ | ||
52 | virtual void setUrl( const QString& ) = 0; | ||
53 | |||
54 | /** | ||
55 | * setOptions | ||
56 | */ | ||
57 | virtual void setOptions( const QStringList& ) = 0; | ||
58 | |||
59 | /** | ||
60 | * tries to open a connection to the database | ||
61 | */ | ||
62 | virtual bool open() = 0; | ||
63 | virtual bool close() = 0; | ||
64 | |||
65 | virtual OSQLError lastError() = 0; | ||
66 | |||
67 | /** | ||
68 | * Query the Database with a OSQLQuery | ||
69 | * OSQLResult holds the result | ||
70 | */ | ||
71 | virtual OSQLResult query( OSQLQuery* ) = 0; | ||
72 | |||
73 | /** | ||
74 | * Get a list of tables | ||
75 | */ | ||
76 | virtual OSQLTable::ValueList tables() const = 0l; | ||
77 | virtual bool sync(); | ||
78 | |||
79 | |||
80 | private: | ||
81 | QLibrary* m_lib; | ||
82 | class OSQLDriverPrivate; | ||
83 | OSQLDriverPrivate *d; | ||
84 | |||
85 | }; | ||
86 | |||
87 | #endif | ||