VTK: IO/SQL/vtkSQLiteDatabase.h Source File

| VTK 9.3.1

vtkSQLiteDatabase.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
36 #ifndef vtkSQLiteDatabase_h
37 #define vtkSQLiteDatabase_h
38
39 #include "vtkIOSQLModule.h" // For export macro
40 #include "vtkSQLDatabase.h"
41
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkSQLQuery;
44 class vtkSQLiteQuery;
45 class vtkStringArray;
46 class vtkSQLiteDatabaseInternals;
47
48 class VTKIOSQL_EXPORT vtkSQLiteDatabase : public vtkSQLDatabase
49 {
50
51 friend class vtkSQLiteQuery;
52
53 public:
54 vtkTypeMacro(vtkSQLiteDatabase, vtkSQLDatabase);
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56 static vtkSQLiteDatabase* New();
57
58 enum
59 {
60 USE_EXISTING,
61 USE_EXISTING_OR_CREATE,
62 CREATE_OR_CLEAR,
63 CREATE
64 };
65
67
76 bool Open(const char* password) override;
77 bool Open(const char* password, int mode);
79
83 void Close() override;
84
88 bool IsOpen() override;
89
93 vtkSQLQuery* GetQueryInstance() override;
94
98 vtkStringArray* GetTables() override;
99
103 vtkStringArray* GetRecord(const char* table) override;
104
108 bool IsSupported(int feature) override;
109
113 bool HasError() override;
114
118 const char* GetLastErrorText() override;
119
121
124 const char* GetDatabaseType() override { return this->DatabaseType; }
126
128
131 vtkGetFilePathMacro(DatabaseFileName);
132 vtkSetFilePathMacro(DatabaseFileName);
134
138 vtkStdString GetURL() override;
139
148 vtkStdString GetColumnSpecification(
149 vtkSQLDatabaseSchema* schema, int tblHandle, int colHandle) override;
150
151 protected:
152 vtkSQLiteDatabase();
153 ~vtkSQLiteDatabase() override;
154
160 bool ParseURL(const char* url) override;
161
162 private:
163 vtkSQLiteDatabaseInternals* Internal;
164
165 // We want this to be private, a user of this class
166 // should not be setting this for any reason
167 vtkSetStringMacro(DatabaseType);
168
169 vtkStringArray* Tables;
170
171 char* DatabaseType;
172 char* DatabaseFileName;
173
174 vtkStdString TempURL;
175
176 vtkSQLiteDatabase(const vtkSQLiteDatabase&) = delete;
177 void operator=(const vtkSQLiteDatabase&) = delete;
178 };
179
180 VTK_ABI_NAMESPACE_END
181 #endif // vtkSQLiteDatabase_h
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkSQLDatabaseSchema
represent an SQL database schema
Definition: vtkSQLDatabaseSchema.h:50
vtkSQLDatabase
maintain a connection to an sql database
Definition: vtkSQLDatabase.h:76
vtkSQLQuery
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:60
vtkSQLiteDatabaseInternals
Definition: vtkSQLiteDatabaseInternals.h:11
vtkSQLiteDatabase
maintain a connection to an SQLite database
Definition: vtkSQLiteDatabase.h:49
vtkSQLiteDatabase::Open
bool Open(const char *password) override
Open a new connection to the database.
vtkSQLiteDatabase::USE_EXISTING
@ USE_EXISTING
Definition: vtkSQLiteDatabase.h:60
vtkSQLiteDatabase::CREATE_OR_CLEAR
@ CREATE_OR_CLEAR
Definition: vtkSQLiteDatabase.h:62
vtkSQLiteDatabase::USE_EXISTING_OR_CREATE
@ USE_EXISTING_OR_CREATE
Definition: vtkSQLiteDatabase.h:61
vtkSQLiteDatabase::Open
bool Open(const char *password, int mode)
Open a new connection to the database.
vtkSQLiteDatabase::HasError
bool HasError() override
Did the last operation generate an error.
vtkSQLiteDatabase::IsOpen
bool IsOpen() override
Return whether the database has an open connection.
vtkSQLiteDatabase::ParseURL
bool ParseURL(const char *url) override
Overridden to determine connection parameters given the URL.
vtkSQLiteDatabase::GetRecord
vtkStringArray * GetRecord(const char *table) override
Get the list of fields for a particular table.
vtkSQLiteDatabase::GetColumnSpecification
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.
vtkSQLiteDatabase::GetTables
vtkStringArray * GetTables() override
Get the list of tables from the database.
vtkSQLiteDatabase::vtkSetFilePathMacro
vtkSetFilePathMacro(DatabaseFileName)
String representing the database filename.
vtkSQLiteDatabase::GetURL
vtkStdString GetURL() override
Get the URL of the database.
vtkSQLiteDatabase::vtkSQLiteDatabase
vtkSQLiteDatabase()
vtkSQLiteDatabase::New
static vtkSQLiteDatabase * New()
vtkSQLiteDatabase::IsSupported
bool IsSupported(int feature) override
Return whether a feature is supported by the database.
vtkSQLiteDatabase::Close
void Close() override
Close the connection to the database.
vtkSQLiteDatabase::vtkGetFilePathMacro
vtkGetFilePathMacro(DatabaseFileName)
String representing the database filename.
vtkSQLiteDatabase::~vtkSQLiteDatabase
~vtkSQLiteDatabase() override
vtkSQLiteDatabase::GetLastErrorText
const char * GetLastErrorText() override
Get the last error text from the database.
vtkSQLiteDatabase::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSQLiteDatabase::GetDatabaseType
const char * GetDatabaseType() override
String representing database type (e.g.
Definition: vtkSQLiteDatabase.h:124
vtkSQLiteDatabase::GetQueryInstance
vtkSQLQuery * GetQueryInstance() override
Return an empty query on this database.
vtkSQLiteQuery
vtkSQLQuery implementation for SQLite databases
Definition: vtkSQLiteQuery.h:40
vtkSQLiteQuery::vtkSQLiteDatabase
friend class vtkSQLiteDatabase
Definition: vtkSQLiteQuery.h:42
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:41
vtkX3D::mode
@ mode
Definition: vtkX3D.h:247
vtkX3D::url
@ url
Definition: vtkX3D.h:233
vtkSQLDatabase.h