VTK  9.1.0
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-------------------------------------------------------------------------*/
46#ifndef vtkSQLiteDatabase_h
47#define vtkSQLiteDatabase_h
48
49#include "vtkIOSQLModule.h" // For export macro
50#include "vtkSQLDatabase.h"
51
52class vtkSQLQuery;
53class vtkSQLiteQuery;
54class vtkStringArray;
56
57class VTKIOSQL_EXPORT vtkSQLiteDatabase : public vtkSQLDatabase
58{
59
60 friend class vtkSQLiteQuery;
61
62public:
64 void PrintSelf(ostream& os, vtkIndent indent) override;
66
67 enum
68 {
72 CREATE
73 };
74
76
85 bool Open(const char* password) override;
86 bool Open(const char* password, int mode);
88
92 void Close() override;
93
97 bool IsOpen() override;
98
103
108
112 vtkStringArray* GetRecord(const char* table) override;
113
117 bool IsSupported(int feature) override;
118
122 bool HasError() override;
123
127 const char* GetLastErrorText() override;
128
130
133 const char* GetDatabaseType() override { return this->DatabaseType; }
135
137
140 vtkGetFilePathMacro(DatabaseFileName);
141 vtkSetFilePathMacro(DatabaseFileName);
143
148
158 vtkSQLDatabaseSchema* schema, int tblHandle, int colHandle) override;
159
160protected:
163
169 bool ParseURL(const char* url) override;
170
171private:
173
174 // We want this to be private, a user of this class
175 // should not be setting this for any reason
176 vtkSetStringMacro(DatabaseType);
177
178 vtkStringArray* Tables;
179
180 char* DatabaseType;
181 char* DatabaseFileName;
182
183 vtkStdString TempURL;
184
185 vtkSQLiteDatabase(const vtkSQLiteDatabase&) = delete;
186 void operator=(const vtkSQLiteDatabase&) = delete;
187};
188
189#endif // vtkSQLiteDatabase_h
a simple class to control print indentation
Definition: vtkIndent.h:113
represent an SQL database schema
maintain a connection to an sql database
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:69
maintain a connection to an SQLite database
bool Open(const char *password) override
Open a new connection to the database.
bool Open(const char *password, int mode)
Open a new connection to the database.
bool HasError() override
Did the last operation generate an error.
const char * GetDatabaseType() override
String representing database type (e.g.
vtkStringArray * GetTables() override
Get the list of tables from the database.
bool IsOpen() override
Return whether the database has an open connection.
bool ParseURL(const char *url) override
Overridden to determine connection parameters given the URL.
vtkStdString GetColumnSpecification(vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle) override
Return the SQL string with the syntax to create a column inside a "CREATE TABLE" SQL statement.
vtkSetFilePathMacro(DatabaseFileName)
String representing the database filename.
vtkStdString GetURL() override
Get the URL of the database.
bool IsSupported(int feature) override
Return whether a feature is supported by the database.
void Close() override
Close the connection to the database.
const char * GetLastErrorText() override
Get the last error text from the database.
vtkGetFilePathMacro(DatabaseFileName)
String representing the database filename.
~vtkSQLiteDatabase() override
static vtkSQLiteDatabase * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSQLQuery * GetQueryInstance() override
Return an empty query on this database.
vtkStringArray * GetRecord(const char *table) override
Get the list of fields for a particular table.
vtkSQLQuery implementation for SQLite databases
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
a vtkAbstractArray subclass for strings