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 -------------------------------------------------------------------------*/
57 #ifndef vtkSQLQuery_h
58 #define vtkSQLQuery_h
59 
60 #include "vtkIOSQLModule.h" // For export macro
61 #include "vtkRowQuery.h"
62 #include "vtkStdString.h" // for EscapeString()
63 
64 class vtkSQLDatabase;
65 class vtkVariant;
66 class vtkVariantArray;
67 
68 class VTKIOSQL_EXPORT vtkSQLQuery : public vtkRowQuery
69 {
70 public:
71  vtkTypeMacro(vtkSQLQuery, vtkRowQuery);
72  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
73 
75 
80  virtual bool SetQuery(const char *query);
81  virtual const char *GetQuery();
83 
89  bool IsActive() VTK_OVERRIDE { return this->Active; }
90 
96  bool Execute() VTK_OVERRIDE = 0;
97 
103  virtual bool BeginTransaction() { return true; }
104  virtual bool CommitTransaction() { return true; }
105  virtual bool RollbackTransaction() { return true; }
106 
108 
111  vtkGetObjectMacro(Database, vtkSQLDatabase);
113 
143  virtual bool BindParameter(int index, unsigned char value);
144  virtual bool BindParameter(int index, unsigned short value);
145  virtual bool BindParameter(int index, unsigned int value);
146  virtual bool BindParameter(int index, unsigned long value);
147  // The C and C++ standards leave it up to each compiler to decide
148  // whether chars are signed or unsigned by default. All the other
149  // types are signed unless otherwise specified.
150  virtual bool BindParameter(int index, signed char value);
151  virtual bool BindParameter(int index, short value);
152 
153  virtual bool BindParameter(int index, int value);
154 
155  virtual bool BindParameter(int index, long value);
156  virtual bool BindParameter(int index, unsigned long long value);
157  virtual bool BindParameter(int index, long long value);
158 
159  virtual bool BindParameter(int index, float value);
160  virtual bool BindParameter(int index, double value);
164  virtual bool BindParameter(int index, const char *stringValue);
168  virtual bool BindParameter(int index, const char *stringValue, size_t length);
169 
170  virtual bool BindParameter(int index, const vtkStdString &string);
171 
172  virtual bool BindParameter(int index, vtkVariant var);
178  virtual bool BindParameter(int index, const void *data, size_t length);
182  virtual bool ClearParameterBindings();
183 
194  virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true );
195 
205  char* EscapeString( const char* src, bool addSurroundingQuotes );
206 
207 protected:
208  vtkSQLQuery();
209  ~vtkSQLQuery() VTK_OVERRIDE;
210 
217  void SetDatabase(vtkSQLDatabase* db);
218 
219  char* Query;
221  bool Active;
222 
223 private:
224  vtkSQLQuery(const vtkSQLQuery &) VTK_DELETE_FUNCTION;
225  void operator=(const vtkSQLQuery &) VTK_DELETE_FUNCTION;
226 };
227 
228 #endif // vtkSQLQuery_h
229 
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
An array holding vtkVariants.
bool IsActive() override
Return true if the query is active (i.e.
Definition: vtkSQLQuery.h:89
virtual bool CommitTransaction()
Definition: vtkSQLQuery.h:104
char * Query
Definition: vtkSQLQuery.h:219
abstract interface for queries that return row-oriented results.
Definition: vtkRowQuery.h:62
A atomic type representing the union of many types.
Definition: vtkVariant.h:69
maintain a connection to an sql database
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual bool RollbackTransaction()
Definition: vtkSQLQuery.h:105
virtual bool BeginTransaction()
Begin, commit, or roll back a transaction.
Definition: vtkSQLQuery.h:103
vtkSQLDatabase * Database
Definition: vtkSQLQuery.h:220
virtual bool Execute()=0
Execute the query.
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:68
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.