From 86352e32f449ecf00de254674b7dcac72bc34a14 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 27 Aug 2002 20:17:50 +0000 Subject: Initial check in of the light wrapper library around normal SQL The first driver implementation is a SQLite version --- (limited to 'libsql/osqlquery.h') 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 @@ + +#ifndef OSQL_QUERY_H +#define OSQL_QUERY_H + +#include +#include +#include + + +/** I'm not happy with them +class OSQLQueryOrder { +public: + typedef QValueList ValueList; + OSQLQueryOrder(const QString& table = QString::null ); + OSQLQueryOrder( const OSQLQueryOrder& ); + ~OSQLQueryOrder(); + void setOrderFields( const QStringList& list ); + void setValue( const QString& fieldName, const QString& Value ); + void setValues( const QMap& ); + QMap orders() const; + QString orderStatement()const; + OSQLQueryOrder &operator=(const OSQLQueryOrder& ); +private: + QMap m_fields; + class OSQLQueryOrderPrivate; + OSQLQueryOrderPrivate* d; +}; +class OSQLWhere { +public: + typedef QValueList ValueList; + enum Vergleiche { Equal = 0, Like, Greater, GreaterEqual, + Smaller, SmallerEqual }; + OSQLWhere(const QString& table = QString::null ); + ~OSQLWhere(); + void setExpression(const QString& key, enum Vergleiche, const QString& ); + QString statement()const; +private: + int m_vergleich; + const QString& m_left; + const QString& m_right; + +}; +*/ +class OSQLQuery { +public: + OSQLQuery(); + virtual ~OSQLQuery(); + + virtual QString query()const = 0; +}; + +class OSQLRawQuery : public OSQLQuery { +public: + OSQLRawQuery( const QString& query ); + ~OSQLRawQuery(); + QString query() const; +private: + class OSQLRawQueryPrivate; + OSQLRawQueryPrivate* d; + QString m_query; + +}; +/* I'm not happy with them again +class OSQLSelectQuery : public OSQLQuery { +public: + OSQLSelectQuery(); + ~OSQLSelectQuery(); + void setTables( const QStringList& allTablesToQuery ); + void setValues( const QString& table, const QStringList& columns ); + void setOrder( const OSQLSelectQuery& ); + void setOrderList( const OSQLQueryOrder::ValueList& ); + void setWhereList( const OSQLWhere& ); + void setWhereList( const OSQLWhere::ValueList& ); + QString query()const; +private: + QStringList m_tables; + QMap m_values; + OSQLQueryOrder::ValueList m_order; + OSQLWhere::ValueList m_where; + class OSQLSelectQueryPrivate; + OSQLSelectQueryPrivate* d; +}; +class OSQLInsertQuery : public OSQLQuery { +public: + OSQLInsertQuery(const QString& table); + ~OSQLInsertQuery(); + void setInserFields( const QStringList& ); + void setValue( const QString& field, const QString& value ); + void setValues(const QMap& ); + QString query()const; +private: + QString m_table; + QStringList m_fields; + QMap m_values; +}; +class OSQLDeleteQuery : public OSQLQuery { +public: + OSQLDeleteQuery(const QString& table); + ~OSQLDeleteQuery(); + void setWhere( const OSQLWhere& ); + void setWheres( const OSQLWhere::ValueList& ); + QString query()const; +private: + QString m_table; + OSQLWhere::ValueList m_where; + +}; +class OSQLUpdateQuery : public OSQLQuery { +public: + OSQLUpdateQuery( const QString& table ); + ~OSQLUpdateQuery(); + void setWhere( const OSQLWhere& ); + void setWheres( const OSQLWhere::ValueList& ); + */ + /* replaces all previous set Values */ + /* + void setValue( const QString& field, const QString& value ); + void setValue( const QMap &fields ); + QString query() const; +}; +*/ +#endif -- cgit v0.9.0.2