• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/IO/vtkSQLQuery.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSQLQuery.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00059 #ifndef __vtkSQLQuery_h
00060 #define __vtkSQLQuery_h
00061 
00062 #include "vtkRowQuery.h"
00063 #include "vtkStdString.h" // for EscapeString()
00064 
00065 class vtkSQLDatabase;
00066 class vtkVariant;
00067 class vtkVariantArray;
00068 
00069 class VTK_IO_EXPORT vtkSQLQuery : public vtkRowQuery
00070 {
00071 public:
00072   vtkTypeRevisionMacro(vtkSQLQuery, vtkRowQuery);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076 
00079   virtual bool SetQuery(const char *query);
00080   virtual const char *GetQuery();
00082 
00086   bool IsActive() { return this->Active; }
00087 
00090   virtual bool Execute() = 0;
00091 
00093 
00095   virtual bool BeginTransaction() { return true; }
00096   virtual bool CommitTransaction() { return true; }
00097   virtual bool RollbackTransaction() { return true; }
00099 
00101 
00102   vtkGetObjectMacro(Database, vtkSQLDatabase);
00104 
00125 //BTX
00126   virtual bool BindParameter(int index, unsigned char value);
00127   virtual bool BindParameter(int index, unsigned short value);
00128   virtual bool BindParameter(int index, unsigned int value);
00129   virtual bool BindParameter(int index, unsigned long value);
00130   // The C and C++ standards leave it up to each compiler to decide
00131   // whether chars are signed or unsigned by default.  All the other
00132   // types are signed unless otherwise specified.
00133   virtual bool BindParameter(int index, signed char value);
00134   virtual bool BindParameter(int index, short value);
00135 //ETX
00136   virtual bool BindParameter(int index, int value);
00137 //BTX
00138   virtual bool BindParameter(int index, long value);
00139   virtual bool BindParameter(int index, vtkTypeUInt64 value);
00140   virtual bool BindParameter(int index, vtkTypeInt64 value);
00141 //ETX
00142   virtual bool BindParameter(int index, float value);
00143   virtual bool BindParameter(int index, double value);
00145 
00146   virtual bool BindParameter(int index, const char *stringValue);
00147   // Description:
00148   // Bind a string value by specifying an array and a size
00149   virtual bool BindParameter(int index, const char *stringValue, size_t length);
00151 //BTX
00152   virtual bool BindParameter(int index, const vtkStdString &string);
00153   virtual bool BindParameter(int index, vtkVariant var);
00154 //ETX
00156 
00158   virtual bool BindParameter(int index, const void *data, size_t length);
00159   // Description:
00160   // Reset all parameter bindings to NULL.
00161   virtual bool ClearParameterBindings();
00163 
00164   //BTX
00166 
00172   virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true );
00173   //ETX
00175 
00182   char* EscapeString( const char* src, bool addSurroundingQuotes );
00183 
00184 protected:
00185   vtkSQLQuery();
00186   ~vtkSQLQuery();
00187 
00191   void SetDatabase(vtkSQLDatabase* db);
00192 
00193   char* Query;
00194   vtkSQLDatabase* Database;
00195   bool Active;
00196 
00197 private:
00198   vtkSQLQuery(const vtkSQLQuery &); // Not implemented.
00199   void operator=(const vtkSQLQuery &); // Not implemented.
00200 };
00201 
00202 #endif // __vtkSQLQuery_h
00203 

Generated by  doxygen 1.7.1