VTK
vtkSQLiteDatabase.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSQLiteDatabase.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 -------------------------------------------------------------------------*/
51 #ifndef vtkSQLiteDatabase_h
52 #define vtkSQLiteDatabase_h
53 
54 #include "vtkIOSQLModule.h" // For export macro
55 #include "vtkSQLDatabase.h"
56 
57 class vtkSQLQuery;
58 class vtkSQLiteQuery;
59 class vtkStringArray;
60 struct vtk_sqlite3;
61 
63 {
64  //BTX
65  friend class vtkSQLiteQuery;
66  //ETX
67 
68 public:
70  void PrintSelf(ostream& os, vtkIndent indent);
71  static vtkSQLiteDatabase *New();
72 
73  //BTX
74  enum {
78  CREATE
79  };
80  //ETX
81 
83 
89  bool Open(const char* password);
90  bool Open(const char* password, int mode);
92 
94  void Close();
95 
97  bool IsOpen();
98 
101 
104 
106  vtkStringArray* GetRecord(const char *table);
107 
109  bool IsSupported(int feature);
110 
112  bool HasError();
113 
115  const char* GetLastErrorText();
116 
118 
119  vtkGetStringMacro(DatabaseType);
121 
123 
124  vtkGetStringMacro(DatabaseFileName);
125  vtkSetStringMacro(DatabaseFileName);
127 
129  virtual vtkStdString GetURL();
130 
132 
137  int tblHandle,
138  int colHandle );
140 
141 protected:
144 
148  virtual bool ParseURL(const char* url);
149 
150 private:
151  vtk_sqlite3 *SQLiteInstance;
152 
153  // We want this to be private, a user of this class
154  // should not be setting this for any reason
155  vtkSetStringMacro(DatabaseType);
156 
157  vtkStringArray *Tables;
158 
159  char* DatabaseType;
160  char* DatabaseFileName;
161 
162  vtkStdString TempURL;
163 
164  vtkSQLiteDatabase(const vtkSQLiteDatabase &); // Not implemented.
165  void operator=(const vtkSQLiteDatabase &); // Not implemented.
166 };
167 
168 #endif // vtkSQLiteDatabase_h
169 
friend class vtkSQLiteDatabase
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
virtual vtkStdString GetColumnSpecification(vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle)
virtual bool IsSupported(int vtkNotUsed(feature))
void PrintSelf(ostream &os, vtkIndent indent)
virtual bool Open(const char *password)=0
virtual bool ParseURL(const char *url)=0
maintain a connection to an SQLite database
virtual bool HasError()=0
a vtkAbstractArray subclass for strings
virtual vtkStdString GetURL()=0
represent an SQL database schema
virtual vtkStringArray * GetRecord(const char *table)=0
maintain a connection to an sql database
vtkSQLQuery implementation for SQLite databases
virtual void Close()=0
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual vtkSQLQuery * GetQueryInstance()=0
virtual bool IsOpen()=0
virtual const char * GetLastErrorText()=0
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:73
#define VTKIOSQL_EXPORT
static vtkObject * New()
virtual vtkStringArray * GetTables()=0