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 00077 vtkGetStringMacro(Query); 00078 vtkSetStringMacro(Query); 00080 00084 bool IsActive() { return this->Active; } 00085 00088 virtual bool Execute() = 0; 00089 00091 00093 virtual bool BeginTransaction() { return true; } 00094 virtual bool CommitTransaction() { return true; } 00095 virtual bool RollbackTransaction() { return true; } 00097 00099 00100 vtkGetObjectMacro(Database, vtkSQLDatabase); 00102 00103 //BTX 00105 00111 virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true ); 00112 //ETX 00114 00121 char* EscapeString( const char* src, bool addSurroundingQuotes ); 00122 00123 protected: 00124 vtkSQLQuery(); 00125 ~vtkSQLQuery(); 00126 00130 void SetDatabase(vtkSQLDatabase* db); 00131 00132 char* Query; 00133 vtkSQLDatabase* Database; 00134 bool Active; 00135 00136 private: 00137 vtkSQLQuery(const vtkSQLQuery &); // Not implemented. 00138 void operator=(const vtkSQLQuery &); // Not implemented. 00139 }; 00140 00141 #endif // __vtkSQLQuery_h 00142