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 sqlite3_stmt;
53 
55 {
56  //BTX
57  friend class vtkSQLiteDatabase;
58  //ETX
59 
60 public:
62  void PrintSelf(ostream& os, vtkIndent indent);
63  static vtkSQLiteQuery *New();
64 
67  bool SetQuery(const char *query);
68 
71  bool Execute();
72 
75 
77  const char* GetFieldName(int i);
78 
81  int GetFieldType(int i);
82 
84  bool NextRow();
85 
87  bool HasError();
88 
90 
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
135 
136 
138  bool BindParameter(int index, const void *data, size_t length);
141 
142 protected:
145 
146  vtkSetStringMacro(LastErrorText);
147 
148 private:
149  vtkSQLiteQuery(const vtkSQLiteQuery &); // Not implemented.
150  void operator=(const vtkSQLiteQuery &); // Not implemented.
151 
152  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 
vtkSQLiteQuery::NextRow
bool NextRow()
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkSQLiteQuery::vtkSQLiteQuery
vtkSQLiteQuery()
vtkSQLiteQuery::SetQuery
bool SetQuery(const char *query)
vtkSQLiteQuery::GetFieldName
const char * GetFieldName(int i)
vtkgl::query
GLenum query
Definition: vtkgl.h:14432
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, vtkTypeInt64 value)
vtkSQLiteQuery::~vtkSQLiteQuery
~vtkSQLiteQuery()
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, const vtkStdString &string)
vtkSQLiteQuery::New
static vtkSQLiteQuery * New()
vtkSQLiteQuery::BeginTransaction
bool BeginTransaction()
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, int value)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkSQLiteQuery::RollbackTransaction
bool RollbackTransaction()
vtkSQLiteQuery::Execute
bool Execute()
vtkSQLiteDatabase::vtkSQLiteQuery
friend class vtkSQLiteQuery
Definition: vtkSQLiteDatabase.h:65
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:48
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, signed char value)
vtkgl::length
GLuint GLsizei GLsizei * length
Definition: vtkgl.h:11992
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, short value)
vtkSQLQuery::BindParameter
virtual bool BindParameter(int index, unsigned char value)
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, unsigned long value)
vtkSQLiteQuery::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, const void *data, size_t length)
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, unsigned char value)
vtkgl::value
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
vtkgl::c
const GLubyte * c
Definition: vtkgl.h:15720
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, float value)
vtkIOSQLModule.h
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, long value)
vtkSQLiteDatabase
maintain a connection to an SQLite database
Definition: vtkSQLiteDatabase.h:63
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, vtkVariant value)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSQLiteQuery::HasError
bool HasError()
vtkSetStringMacro
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:104
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, unsigned int value)
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:79
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, const char *stringValue)
vtkSQLiteQuery::GetFieldType
int GetFieldType(int i)
vtkSQLiteQuery::GetNumberOfFields
int GetNumberOfFields()
vtkSQLiteQuery::ClearParameterBindings
bool ClearParameterBindings()
vtkSQLiteQuery::CommitTransaction
bool CommitTransaction()
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, vtkTypeUInt64 value)
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkSQLQuery.h
VTKIOSQL_EXPORT
#define VTKIOSQL_EXPORT
Definition: vtkIOSQLModule.h:15
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:48
vtkSQLQuery
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:74
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, const char *stringValue, size_t length)
vtkSQLiteQuery::GetLastErrorText
const char * GetLastErrorText()
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, unsigned short value)
vtkSQLiteQuery::BindParameter
bool BindParameter(int index, double value)
vtkSQLiteQuery::DataValue
vtkVariant DataValue(vtkIdType c)
vtkSQLiteQuery
vtkSQLQuery implementation for SQLite databases
Definition: vtkSQLiteQuery.h:55