Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osqlresult.h

Go to the documentation of this file.
00001 #ifndef OSQL_RESULT_H
00002 #define OSQL_RESULT_H
00003 
00004 #include <qdatetime.h>
00005 #include <qmap.h>
00006 #include <qvaluelist.h>
00007 
00008 
00009 #include "osqlerror.h"
00010 
00011 namespace Opie {
00012 namespace DB {
00013 
00017 class OSQLResultItem {
00018 public:
00019     typedef QValueList<OSQLResultItem> ValueList;
00024     typedef QMap<QString, QString> TableString;
00025 
00030     typedef QMap<int, QString> TableInt;
00031 
00035     OSQLResultItem(const TableString& = TableString(),
00036                    const TableInt& = TableInt() );
00037     OSQLResultItem( const OSQLResultItem& );
00038     ~OSQLResultItem();
00039     OSQLResultItem &operator=( const OSQLResultItem& );
00043     TableString tableString()const;
00044 
00048     TableInt tableInt() const;
00049 
00054     QString data( const QString& columnName, bool *ok = 0) const;
00055 
00059     QString data(int columnNumber, bool *ok = 0) const;
00060 
00064     QDate dataToDate( const QString& columnName, bool *ok = 0 );
00065 
00069     QDate dataToDate( int columnNumber, bool *ok = 0 );
00070 
00071     QDateTime dataToDateTime( const QString& columName, bool *ok = 0 );
00072     QDateTime dataToDateTime( int columnNumber, bool *ok = 0 );
00073 private:
00074     TableString m_string;
00075     TableInt m_int;
00076 };
00077 
00082 class OSQLResult {
00083 public:
00085     enum State{ Success = 0, Failure,Undefined };
00086 
00093     OSQLResult( enum State state = Undefined,
00094                 const OSQLResultItem::ValueList& r= OSQLResultItem::ValueList(),
00095                 const OSQLError::ValueList& errors = OSQLError::ValueList() );
00096     ~OSQLResult();
00097     State state()const;
00098     OSQLError::ValueList errors()const;
00099     OSQLResultItem::ValueList results()const;
00100 
00101     void setState( enum State state );
00102     void setErrors( const OSQLError::ValueList& error );
00103     void setResults( const OSQLResultItem::ValueList& result );
00104 
00105     OSQLResultItem first();
00106     OSQLResultItem next();
00107     bool atEnd();
00108     OSQLResultItem::ValueList::ConstIterator iterator()const;
00109 private:
00110     enum State m_state;
00111     OSQLResultItem::ValueList m_list;
00112     OSQLError::ValueList m_error;
00113     OSQLResultItem::ValueList::Iterator it;
00114     class Private;
00115     Private *d;
00116 };
00117 
00118 }
00119 }
00120 #endif

Generated on Sat Nov 5 16:16:11 2005 for OPIE by  doxygen 1.4.2