VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/SQL/vtkSQLQuery.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSQLQuery.h
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 -------------------------------------------------------------------------*/
00062 #ifndef vtkSQLQuery_h
00063 #define vtkSQLQuery_h
00064 
00065 #include "vtkIOSQLModule.h" // For export macro
00066 #include "vtkRowQuery.h"
00067 #include "vtkStdString.h" // for EscapeString()
00068 
00069 class vtkSQLDatabase;
00070 class vtkVariant;
00071 class vtkVariantArray;
00072 
00073 class VTKIOSQL_EXPORT vtkSQLQuery : public vtkRowQuery
00074 {
00075 public:
00076   vtkTypeMacro(vtkSQLQuery, vtkRowQuery);
00077   void PrintSelf(ostream& os, vtkIndent indent);
00078 
00080 
00083   virtual bool SetQuery(const char *query);
00084   virtual const char *GetQuery();
00086 
00090   bool IsActive() { return this->Active; }
00091 
00094   virtual bool Execute() = 0;
00095 
00097 
00099   virtual bool BeginTransaction() { return true; }
00100   virtual bool CommitTransaction() { return true; }
00101   virtual bool RollbackTransaction() { return true; }
00103 
00105 
00106   vtkGetObjectMacro(Database, vtkSQLDatabase);
00108 
00109 //BTX
00130   virtual bool BindParameter(int index, unsigned char value);
00131   virtual bool BindParameter(int index, unsigned short value);
00132   virtual bool BindParameter(int index, unsigned int value);
00133   virtual bool BindParameter(int index, unsigned long value);
00134   // The C and C++ standards leave it up to each compiler to decide
00135   // whether chars are signed or unsigned by default.  All the other
00136   // types are signed unless otherwise specified.
00137   virtual bool BindParameter(int index, signed char value);
00138   virtual bool BindParameter(int index, short value);
00139 //ETX
00140   virtual bool BindParameter(int index, int value);
00141 //BTX
00142   virtual bool BindParameter(int index, long value);
00143   virtual bool BindParameter(int index, vtkTypeUInt64 value);
00144   virtual bool BindParameter(int index, vtkTypeInt64 value);
00145 //ETX
00146   virtual bool BindParameter(int index, float value);
00147   virtual bool BindParameter(int index, double value);
00149   virtual bool BindParameter(int index, const char *stringValue);
00151 
00152   virtual bool BindParameter(int index, const char *stringValue, size_t length);
00153 //BTX
00154   virtual bool BindParameter(int index, const vtkStdString &string);
00155 //ETX
00156   virtual bool BindParameter(int index, vtkVariant var);
00158 
00160   virtual bool BindParameter(int index, const void *data, size_t length);
00162   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