Isis 3 Programmer Reference
SqlRecord.h
Go to the documentation of this file.
1 #ifndef SqlRecord_h
2 #define SqlRecord_h
3 
26 #include <string>
27 #include <vector>
28 #include <iostream>
29 #include "IException.h"
30 #include <QSqlRecord>
31 
32 class QString;
33 
34 namespace Isis {
35 
36  class SqlQuery;
37 
62  class SqlRecord : public QSqlRecord {
63  public:
64  SqlRecord();
65  SqlRecord(const SqlQuery &query);
66  virtual ~SqlRecord() { }
67 
76  int size() const {
77  return (count());
78  }
79 
80  bool hasField(const QString &name) const;
81  int getFieldIndex(const QString &name) const;
82  QString getFieldName(int index) const;
83 
84  QString getType(int index) const;
85  QString getType(const QString &name) const;
86 
87  bool isNull(const QString &name) const;
88  QString getValue(int index) const;
89  QString getValue(const QString &name) const;
90 
91  private:
92  QString QtTypeField(const char *ctype) const;
93 
94  };
95 }
96 #endif
Provide simplified access to resulting SQL query row.
Definition: SqlRecord.h:62
QString getType(int index) const
Returns the type of a field/column at the specified index.
Definition: SqlRecord.cpp:143
bool isNull(const QString &name) const
Determines if the value of the field/column is NULL.
Definition: SqlRecord.cpp:155
bool hasField(const QString &name) const
Indicates the existance/non-existance of a field in the row.
Definition: SqlRecord.cpp:67
QString getFieldName(int index) const
Returns the name of a field/column at a particular index.
Definition: SqlRecord.cpp:81
SqlRecord()
Default Constructor.
Definition: SqlRecord.cpp:43
Construct and execute a query on a database and manage result.
Definition: SqlQuery.h:152
int size() const
Returns the number of fields/columns in query.
Definition: SqlRecord.h:76
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString QtTypeField(const char *ctype) const
Returns a generic field type given a Qt QVariant type.
Definition: SqlRecord.cpp:200
QString getValue(int index) const
Returns the value of the field/column at specified index.
Definition: SqlRecord.cpp:169
int getFieldIndex(const QString &name) const
Return the index of a named field/column This method will determine the index of the named field afte...
Definition: SqlRecord.cpp:94