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-------------------------------------------------------------------------*/
52#ifndef vtkSQLiteDatabase_h
53#define vtkSQLiteDatabase_h
54
55#include "vtkIOSQLModule.h" // For export macro
56#include "vtkSQLDatabase.h"
57
58class vtkSQLQuery;
59class vtkSQLiteQuery;
60class vtkStringArray;
61struct sqlite3;
62
63class VTKIOSQL_EXPORT vtkSQLiteDatabase : public vtkSQLDatabase
64{
65
66 friend class vtkSQLiteQuery;
67
68public:
70 void PrintSelf(ostream& os, vtkIndent indent);
72
73 enum {
77 CREATE
78 };
79
81
90 bool Open(const char* password);
91 bool Open(const char* password, int mode);
93
97 void Close();
98
102 bool IsOpen();
103
108
113
117 vtkStringArray* GetRecord(const char *table);
118
122 bool IsSupported(int feature);
123
127 bool HasError();
128
132 const char* GetLastErrorText();
133
135
138 vtkGetStringMacro(DatabaseType);
140
142
145 vtkGetStringMacro(DatabaseFileName);
146 vtkSetStringMacro(DatabaseFileName);
148
153
161 int tblHandle,
162 int colHandle );
163
164protected:
167
173 virtual bool ParseURL(const char* url);
174
175private:
176 sqlite3 *SQLiteInstance;
177
178 // We want this to be private, a user of this class
179 // should not be setting this for any reason
180 vtkSetStringMacro(DatabaseType);
181
182 vtkStringArray *Tables;
183
184 char* DatabaseType;
185 char* DatabaseFileName;
186
187 vtkStdString TempURL;
188
189 vtkSQLiteDatabase(const vtkSQLiteDatabase &) VTK_DELETE_FUNCTION;
190 void operator=(const vtkSQLiteDatabase &) VTK_DELETE_FUNCTION;
191};
192
193#endif // vtkSQLiteDatabase_h
194
a simple class to control print indentation
Definition: vtkIndent.h:40
represent an SQL database schema
maintain a connection to an sql database
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:75
maintain a connection to an SQLite database
virtual vtkStdString GetURL()
Get the URL of the database.
vtkStringArray * GetTables()
Get the list of tables from the database.
virtual bool ParseURL(const char *url)
Overridden to determine connection parameters given the URL.
bool Open(const char *password, int mode)
vtkSQLQuery * GetQueryInstance()
Return an empty query on this database.
const char * GetLastErrorText()
Get the last error text from the database.
void Close()
Close the connection to the database.
bool IsOpen()
Return whether the database has an open connection.
virtual vtkStdString GetColumnSpecification(vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle)
Return the SQL string with the syntax to create a column inside a "CREATE TABLE" SQL statement.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
static vtkSQLiteDatabase * New()
bool Open(const char *password)
Open a new connection to the database.
vtkStringArray * GetRecord(const char *table)
Get the list of fields for a particular table.
bool IsSupported(int feature)
Return whether a feature is supported by the database.
bool HasError()
Did the last operation generate an error.
vtkSQLQuery implementation for SQLite databases
friend class vtkSQLiteDatabase
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
a vtkAbstractArray subclass for strings
@ mode
Definition: vtkX3D.h:247
@ url
Definition: vtkX3D.h:233
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.