Isis 3 Programmer Reference
SqlRecord.h
1 #ifndef SqlRecord_h
2 #define SqlRecord_h
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <string>
13 #include <vector>
14 #include <iostream>
15 #include "IException.h"
16 #include <QSqlRecord>
17 
18 class QString;
19 
20 namespace Isis {
21 
22  class SqlQuery;
23 
48  class SqlRecord : public QSqlRecord {
49  public:
50  SqlRecord();
51  SqlRecord(const SqlQuery &query);
52  virtual ~SqlRecord() { }
53 
62  int size() const {
63  return (count());
64  }
65 
66  bool hasField(const QString &name) const;
67  int getFieldIndex(const QString &name) const;
68  QString getFieldName(int index) const;
69 
70  QString getType(int index) const;
71  QString getType(const QString &name) const;
72 
73  bool isNull(const QString &name) const;
74  QString getValue(int index) const;
75  QString getValue(const QString &name) const;
76 
77  private:
78  QString QtTypeField(const char *ctype) const;
79 
80  };
81 }
82 #endif
Isis::SqlRecord::SqlRecord
SqlRecord()
Default Constructor.
Definition: SqlRecord.cpp:30
Isis::SqlRecord::hasField
bool hasField(const QString &name) const
Indicates the existance/non-existance of a field in the row.
Definition: SqlRecord.cpp:54
Isis::SqlRecord::QtTypeField
QString QtTypeField(const char *ctype) const
Returns a generic field type given a Qt QVariant type.
Definition: SqlRecord.cpp:187
Isis::SqlRecord::getType
QString getType(int index) const
Returns the type of a field/column at the specified index.
Definition: SqlRecord.cpp:130
Isis::SqlRecord::getFieldIndex
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:81
Isis::SqlRecord::size
int size() const
Returns the number of fields/columns in query.
Definition: SqlRecord.h:62
Isis::SqlRecord::getValue
QString getValue(int index) const
Returns the value of the field/column at specified index.
Definition: SqlRecord.cpp:156
Isis::SqlRecord::isNull
bool isNull(const QString &name) const
Determines if the value of the field/column is NULL.
Definition: SqlRecord.cpp:142
QSqlRecord
Isis::SqlRecord::getFieldName
QString getFieldName(int index) const
Returns the name of a field/column at a particular index.
Definition: SqlRecord.cpp:68
Isis::SqlQuery
Construct and execute a query on a database and manage result.
Definition: SqlQuery.h:138
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::SqlRecord
Provide simplified access to resulting SQL query row.
Definition: SqlRecord.h:48