VTK
vtkQtSQLQuery.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtSQLQuery.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
27 #ifndef vtkQtSQLQuery_h
28 #define vtkQtSQLQuery_h
29 
30 // Check for Qt SQL module before defining this class.
31 #include <qglobal.h> // Needed to check if SQL is available
32 #if (QT_EDITION & QT_MODULE_SQL)
33 
34 #include "vtkGUISupportQtSQLModule.h" // For export macro
35 #include "vtkSQLQuery.h"
36 
37 class vtkVariant;
38 class vtkQtSQLQueryInternals;
39 
41 {
42 public:
43  static vtkQtSQLQuery* New();
44  vtkTypeMacro(vtkQtSQLQuery, vtkSQLQuery);
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
49  virtual bool Execute();
50 
52  virtual int GetNumberOfFields();
53 
55  virtual const char* GetFieldName(int col);
56 
59  virtual int GetFieldType(int col);
60 
62  virtual bool NextRow();
63 
65  virtual vtkVariant DataValue(vtkIdType c);
66 
68  virtual bool HasError();
69 
71  virtual const char* GetLastErrorText();
72 
73 protected:
74  vtkQtSQLQuery();
75  ~vtkQtSQLQuery();
76 
77  vtkQtSQLQueryInternals* Internals;
78  friend class vtkQtSQLDatabase;
79 
80 private:
81 
82  // Using the convenience function internally
83  vtkSetStringMacro(LastErrorText);
84 
85  char* LastErrorText;
86 
87  vtkQtSQLQuery(const vtkQtSQLQuery &); // Not implemented.
88  void operator=(const vtkQtSQLQuery &); // Not implemented.
89 };
90 
91 #endif // (QT_EDITION & QT_MODULE_SQL)
92 #endif // vtkQtSQLQuery_h
93 
virtual bool NextRow()=0
virtual const char * GetFieldName(int i)=0
int vtkIdType
Definition: vtkType.h:247
void PrintSelf(ostream &os, vtkIndent indent)
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
virtual bool HasError()=0
query class associated with vtkQtSQLDatabase
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int GetNumberOfFields()=0
#define VTKGUISUPPORTQTSQL_EXPORT
virtual int GetFieldType(int i)=0
virtual bool Execute()=0
virtual vtkVariant DataValue(vtkIdType c)=0
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:73
virtual const char * GetLastErrorText()=0
static vtkObject * New()
maintains a connection to an sql database