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 "vtkSQLDatabase.h"
55 
56 class vtkSQLQuery;
57 class vtkSQLiteQuery;
58 class vtkStringArray;
59 struct sqlite3;
60 
62 {
63  //BTX
64  friend class vtkSQLiteQuery;
65  //ETX
66 
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent);
70  static vtkSQLiteDatabase *New();
71 
72  //BTX
73  enum {
77  CREATE
78  };
79  //ETX
80 
82 
88  bool Open(const char* password);
89  bool Open(const char* password, int mode);
91 
93  void Close();
94 
96  bool IsOpen();
97 
100 
103 
105  vtkStringArray* GetRecord(const char *table);
106 
108  bool IsSupported(int feature);
109 
111  bool HasError();
112 
114  const char* GetLastErrorText();
115 
117 
118  vtkGetStringMacro(DatabaseType);
120 
122 
123  vtkGetStringMacro(DatabaseFileName);
124  vtkSetStringMacro(DatabaseFileName);
126 
128  virtual vtkStdString GetURL();
129 
131 
136  int tblHandle,
137  int colHandle );
139 
140 protected:
143 
147  virtual bool ParseURL(const char* url);
148 
149 private:
150  sqlite3 *SQLiteInstance;
151 
152  // We want this to be private, a user of this class
153  // should not be setting this for any reason
154  vtkSetStringMacro(DatabaseType);
155 
156  vtkStringArray *Tables;
157 
158  char* DatabaseType;
159  char* DatabaseFileName;
160 
161  vtkStdString TempURL;
162 
163  vtkSQLiteDatabase(const vtkSQLiteDatabase &); // Not implemented.
164  void operator=(const vtkSQLiteDatabase &); // Not implemented.
165 };
166 
167 #endif // __vtkSQLiteDatabase_h
168 
friend class vtkSQLiteDatabase
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
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:37
virtual vtkSQLQuery * GetQueryInstance()=0
virtual bool IsOpen()=0
virtual const char * GetLastErrorText()=0
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:72
#define VTK_IO_EXPORT
static vtkObject * New()
virtual vtkStringArray * GetTables()=0