VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/SQL/vtkSQLiteDatabase.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSQLiteDatabase.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 -------------------------------------------------------------------------*/
00051 #ifndef vtkSQLiteDatabase_h
00052 #define vtkSQLiteDatabase_h
00053 
00054 #include "vtkIOSQLModule.h" // For export macro
00055 #include "vtkSQLDatabase.h"
00056 
00057 class vtkSQLQuery;
00058 class vtkSQLiteQuery;
00059 class vtkStringArray;
00060 struct vtk_sqlite3;
00061 
00062 class VTKIOSQL_EXPORT vtkSQLiteDatabase : public vtkSQLDatabase
00063 {
00064   //BTX
00065   friend class vtkSQLiteQuery;
00066   //ETX
00067 
00068 public:
00069   vtkTypeMacro(vtkSQLiteDatabase, vtkSQLDatabase);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071   static vtkSQLiteDatabase *New();
00072 
00073   //BTX
00074   enum {
00075     USE_EXISTING,
00076     USE_EXISTING_OR_CREATE,
00077     CREATE_OR_CLEAR,
00078     CREATE
00079   };
00080   //ETX
00081 
00083 
00089   bool Open(const char* password);
00090   bool Open(const char* password, int mode);
00092 
00094   void Close();
00095 
00097   bool IsOpen();
00098 
00100   vtkSQLQuery* GetQueryInstance();
00101 
00103   vtkStringArray* GetTables();
00104 
00106   vtkStringArray* GetRecord(const char *table);
00107 
00109   bool IsSupported(int feature);
00110 
00112   bool HasError();
00113 
00115   const char* GetLastErrorText();
00116 
00118 
00119   vtkGetStringMacro(DatabaseType);
00121 
00123 
00124   vtkGetStringMacro(DatabaseFileName);
00125   vtkSetStringMacro(DatabaseFileName);
00127 
00129   virtual vtkStdString GetURL();
00130 
00132 
00136   virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema,
00137                                                int tblHandle,
00138                                                int colHandle );
00140 
00141 protected:
00142   vtkSQLiteDatabase();
00143   ~vtkSQLiteDatabase();
00144 
00148   virtual bool ParseURL(const char* url);
00149 
00150 private:
00151   vtk_sqlite3 *SQLiteInstance;
00152 
00153   // We want this to be private, a user of this class
00154   // should not be setting this for any reason
00155   vtkSetStringMacro(DatabaseType);
00156 
00157   vtkStringArray *Tables;
00158 
00159   char* DatabaseType;
00160   char* DatabaseFileName;
00161 
00162   vtkStdString TempURL;
00163 
00164   vtkSQLiteDatabase(const vtkSQLiteDatabase &); // Not implemented.
00165   void operator=(const vtkSQLiteDatabase &); // Not implemented.
00166 };
00167 
00168 #endif // vtkSQLiteDatabase_h
00169