VTK
vtkSQLQuery.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSQLQuery.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 -------------------------------------------------------------------------*/
62 #ifndef vtkSQLQuery_h
63 #define vtkSQLQuery_h
64 
65 #include "vtkIOSQLModule.h" // For export macro
66 #include "vtkRowQuery.h"
67 #include "vtkStdString.h" // for EscapeString()
68 
69 class vtkSQLDatabase;
70 class vtkVariant;
71 class vtkVariantArray;
72 
74 {
75 public:
76  vtkTypeMacro(vtkSQLQuery, vtkRowQuery);
77  void PrintSelf(ostream& os, vtkIndent indent);
78 
80 
83  virtual bool SetQuery(const char *query);
84  virtual const char *GetQuery();
86 
90  bool IsActive() { return this->Active; }
91 
94  virtual bool Execute() = 0;
95 
97 
99  virtual bool BeginTransaction() { return true; }
100  virtual bool CommitTransaction() { return true; }
101  virtual bool RollbackTransaction() { return true; }
103 
105 
106  vtkGetObjectMacro(Database, vtkSQLDatabase);
108 
109 //BTX
130  virtual bool BindParameter(int index, unsigned char value);
131  virtual bool BindParameter(int index, unsigned short value);
132  virtual bool BindParameter(int index, unsigned int value);
133  virtual bool BindParameter(int index, unsigned long value);
134  // The C and C++ standards leave it up to each compiler to decide
135  // whether chars are signed or unsigned by default. All the other
136  // types are signed unless otherwise specified.
137  virtual bool BindParameter(int index, signed char value);
138  virtual bool BindParameter(int index, short value);
139 //ETX
140  virtual bool BindParameter(int index, int value);
141 //BTX
142  virtual bool BindParameter(int index, long value);
143  virtual bool BindParameter(int index, vtkTypeUInt64 value);
144  virtual bool BindParameter(int index, vtkTypeInt64 value);
145 //ETX
146  virtual bool BindParameter(int index, float value);
147  virtual bool BindParameter(int index, double value);
149  virtual bool BindParameter(int index, const char *stringValue);
151 
152  virtual bool BindParameter(int index, const char *stringValue, size_t length);
153 //BTX
154  virtual bool BindParameter(int index, const vtkStdString &string);
155 //ETX
156  virtual bool BindParameter(int index, vtkVariant var);
158 
160  virtual bool BindParameter(int index, const void *data, size_t length);
162  virtual bool ClearParameterBindings();
163 
164 //BTX
166 
172  virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true );
173 //ETX
175 
182  char* EscapeString( const char* src, bool addSurroundingQuotes );
183 
184 protected:
185  vtkSQLQuery();
186  ~vtkSQLQuery();
187 
191  void SetDatabase(vtkSQLDatabase* db);
192 
193  char* Query;
195  bool Active;
196 
197 private:
198  vtkSQLQuery(const vtkSQLQuery &); // Not implemented.
199  void operator=(const vtkSQLQuery &); // Not implemented.
200 };
201 
202 #endif // vtkSQLQuery_h
203 
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
An array holding vtkVariants.
virtual bool CommitTransaction()
Definition: vtkSQLQuery.h:100
char * Query
Definition: vtkSQLQuery.h:193
bool IsActive()
Definition: vtkSQLQuery.h:90
abstract interface for queries that return row-oriented results.
Definition: vtkRowQuery.h:61
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
maintain a connection to an sql database
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
virtual bool RollbackTransaction()
Definition: vtkSQLQuery.h:101
virtual bool BeginTransaction()
Definition: vtkSQLQuery.h:99
vtkSQLDatabase * Database
Definition: vtkSQLQuery.h:194
virtual bool Execute()=0
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:73
#define VTKIOSQL_EXPORT