VTK
vtkSQLiteQuery.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSQLiteQuery.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 -------------------------------------------------------------------------*/
43 #ifndef vtkSQLiteQuery_h
44 #define vtkSQLiteQuery_h
45 
46 #include "vtkIOSQLModule.h" // For export macro
47 #include "vtkSQLQuery.h"
48 
49 class vtkSQLiteDatabase;
50 class vtkVariant;
51 class vtkVariantArray;
52 struct vtk_sqlite3_stmt;
53 
55 {
56  //BTX
57  friend class vtkSQLiteDatabase;
58  //ETX
59 
60 public:
61  vtkTypeMacro(vtkSQLiteQuery, vtkSQLQuery);
62  void PrintSelf(ostream& os, vtkIndent indent);
63  static vtkSQLiteQuery *New();
64 
67  bool SetQuery(const char *query);
68 
71  bool Execute();
72 
74  int GetNumberOfFields();
75 
77  const char* GetFieldName(int i);
78 
81  int GetFieldType(int i);
82 
84  bool NextRow();
85 
87  bool HasError();
88 
90 
91  bool BeginTransaction();
92  bool RollbackTransaction();
93  bool CommitTransaction();
95 
98 
100  const char* GetLastErrorText();
101 
103 
109  bool BindParameter(int index, unsigned char value);
110  bool BindParameter(int index, signed char value);
111  bool BindParameter(int index, unsigned short value);
112  bool BindParameter(int index, short value);
113  bool BindParameter(int index, unsigned int value);
114 //ETX
115  bool BindParameter(int index, int value);
116 //BTX
117  bool BindParameter(int index, unsigned long value);
118  bool BindParameter(int index, long value);
119  bool BindParameter(int index, vtkTypeUInt64 value);
120  bool BindParameter(int index, vtkTypeInt64 value);
121 //ETX
122  bool BindParameter(int index, float value);
123  bool BindParameter(int index, double value);
125 
126  bool BindParameter(int index, const char *stringValue);
128 
129  bool BindParameter(int index, const char *stringValue, size_t length);
130 //BTX
131  bool BindParameter(int index, const vtkStdString &string);
132 //ETX
133  bool BindParameter(int index, vtkVariant value);
135 
136 
138  bool BindParameter(int index, const void *data, size_t length);
139  bool ClearParameterBindings();
141 
142 protected:
143  vtkSQLiteQuery();
144  ~vtkSQLiteQuery();
145 
146  vtkSetStringMacro(LastErrorText);
147 
148 private:
149  vtkSQLiteQuery(const vtkSQLiteQuery &); // Not implemented.
150  void operator=(const vtkSQLiteQuery &); // Not implemented.
151 
152  vtk_sqlite3_stmt *Statement;
153  bool InitialFetch;
154  int InitialFetchResult;
155  char *LastErrorText;
156  bool TransactionInProgress;
157 
159 
161  bool BindIntegerParameter(int index, int value);
162  bool BindDoubleParameter(int index, double value);
163  bool BindInt64Parameter(int index, vtkTypeInt64 value);
164  bool BindStringParameter(int index, const char *data, int length);
165  bool BindBlobParameter(int index, const void *data, int length);
167 
168 };
169 
170 #endif // vtkSQLiteQuery_h
171 
virtual bool SetQuery(const char *query)
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
virtual bool NextRow()=0
An array holding vtkVariants.
virtual const char * GetFieldName(int i)=0
virtual bool BindParameter(int index, unsigned char value)
maintain a connection to an SQLite database
virtual bool CommitTransaction()
Definition: vtkSQLQuery.h:100
int vtkIdType
Definition: vtkType.h:275
void PrintSelf(ostream &os, vtkIndent indent)
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
virtual bool HasError()=0
friend class vtkSQLiteQuery
vtkSQLQuery implementation for SQLite databases
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int GetNumberOfFields()=0
virtual bool RollbackTransaction()
Definition: vtkSQLQuery.h:101
virtual bool BeginTransaction()
Definition: vtkSQLQuery.h:99
virtual int GetFieldType(int i)=0
virtual bool Execute()=0
virtual bool ClearParameterBindings()
virtual vtkVariant DataValue(vtkIdType c)=0
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:73
virtual const char * GetLastErrorText()=0
#define VTKIOSQL_EXPORT
static vtkObject * New()