summaryrefslogtreecommitdiff
path: root/libsql/osqlquery.h
authorzecke <zecke>2002-08-27 20:17:50 (UTC)
committer zecke <zecke>2002-08-27 20:17:50 (UTC)
commit86352e32f449ecf00de254674b7dcac72bc34a14 (patch) (unidiff)
treeb5803b69ca00dceea1e2a76a5eee390f0748f27e /libsql/osqlquery.h
parent1398b50ffc193bc9ab69ebe198aeda847c39516e (diff)
downloadopie-86352e32f449ecf00de254674b7dcac72bc34a14.zip
opie-86352e32f449ecf00de254674b7dcac72bc34a14.tar.gz
opie-86352e32f449ecf00de254674b7dcac72bc34a14.tar.bz2
Initial check in of the light wrapper library
around normal SQL The first driver implementation is a SQLite version
Diffstat (limited to 'libsql/osqlquery.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libsql/osqlquery.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/libsql/osqlquery.h b/libsql/osqlquery.h
new file mode 100644
index 0000000..63c26b0
--- a/dev/null
+++ b/libsql/osqlquery.h
@@ -0,0 +1,122 @@
1
2#ifndef OSQL_QUERY_H
3#define OSQL_QUERY_H
4
5#include <qmap.h>
6#include <qvaluelist.h>
7#include <qstring.h>
8
9
10/** I'm not happy with them
11class OSQLQueryOrder {
12public:
13 typedef QValueList<OSQLQueryOrder> ValueList;
14 OSQLQueryOrder(const QString& table = QString::null );
15 OSQLQueryOrder( const OSQLQueryOrder& );
16 ~OSQLQueryOrder();
17 void setOrderFields( const QStringList& list );
18 void setValue( const QString& fieldName, const QString& Value );
19 void setValues( const QMap<QString, QString>& );
20 QMap<QString, QString> orders() const;
21 QString orderStatement()const;
22 OSQLQueryOrder &operator=(const OSQLQueryOrder& );
23private:
24 QMap<QString, QString> m_fields;
25 class OSQLQueryOrderPrivate;
26 OSQLQueryOrderPrivate* d;
27};
28class OSQLWhere {
29public:
30 typedef QValueList<OSQLWhere> ValueList;
31 enum Vergleiche { Equal = 0, Like, Greater, GreaterEqual,
32 Smaller, SmallerEqual };
33 OSQLWhere(const QString& table = QString::null );
34 ~OSQLWhere();
35 void setExpression(const QString& key, enum Vergleiche, const QString& );
36 QString statement()const;
37private:
38 int m_vergleich;
39 const QString& m_left;
40 const QString& m_right;
41
42};
43*/
44class OSQLQuery {
45public:
46 OSQLQuery();
47 virtual ~OSQLQuery();
48
49 virtual QString query()const = 0;
50};
51
52class OSQLRawQuery : public OSQLQuery {
53public:
54 OSQLRawQuery( const QString& query );
55 ~OSQLRawQuery();
56 QString query() const;
57private:
58 class OSQLRawQueryPrivate;
59 OSQLRawQueryPrivate* d;
60 QString m_query;
61
62};
63/* I'm not happy with them again
64class OSQLSelectQuery : public OSQLQuery {
65public:
66 OSQLSelectQuery();
67 ~OSQLSelectQuery();
68 void setTables( const QStringList& allTablesToQuery );
69 void setValues( const QString& table, const QStringList& columns );
70 void setOrder( const OSQLSelectQuery& );
71 void setOrderList( const OSQLQueryOrder::ValueList& );
72 void setWhereList( const OSQLWhere& );
73 void setWhereList( const OSQLWhere::ValueList& );
74 QString query()const;
75private:
76 QStringList m_tables;
77 QMap<QString, QStringList> m_values;
78 OSQLQueryOrder::ValueList m_order;
79 OSQLWhere::ValueList m_where;
80 class OSQLSelectQueryPrivate;
81 OSQLSelectQueryPrivate* d;
82};
83class OSQLInsertQuery : public OSQLQuery {
84public:
85 OSQLInsertQuery(const QString& table);
86 ~OSQLInsertQuery();
87 void setInserFields( const QStringList& );
88 void setValue( const QString& field, const QString& value );
89 void setValues(const QMap<QString, QString>& );
90 QString query()const;
91private:
92 QString m_table;
93 QStringList m_fields;
94 QMap<QString, QString> m_values;
95};
96class OSQLDeleteQuery : public OSQLQuery {
97public:
98 OSQLDeleteQuery(const QString& table);
99 ~OSQLDeleteQuery();
100 void setWhere( const OSQLWhere& );
101 void setWheres( const OSQLWhere::ValueList& );
102 QString query()const;
103private:
104 QString m_table;
105 OSQLWhere::ValueList m_where;
106
107};
108class OSQLUpdateQuery : public OSQLQuery {
109public:
110 OSQLUpdateQuery( const QString& table );
111 ~OSQLUpdateQuery();
112 void setWhere( const OSQLWhere& );
113 void setWheres( const OSQLWhere::ValueList& );
114 */
115 /* replaces all previous set Values */
116 /*
117 void setValue( const QString& field, const QString& value );
118 void setValue( const QMap<QString, QString> &fields );
119 QString query() const;
120};
121*/
122#endif