#include <vtkSQLiteDatabase.h>
SQLite (http://www.sqlite.org) is a public-domain SQL database written in C++. It's small, fast, and can be easily embedded inside other applications. Its databases are stored in files.
This class provides a VTK interface to SQLite. You do not need to download any external libraries: we include a copy of SQLite 3.3.16 in VTK/Utilities/vtksqlite.
If you want to open a database that stays in memory and never gets written to disk, pass in the URL 'sqlite://:memory:'; otherwise, specifiy the file path by passing the URL 'sqlite://<file_path>'.
Definition at line 61 of file vtkSQLiteDatabase.h.
Public Types | |
enum | { USE_EXISTING, USE_EXISTING_OR_CREATE, CREATE_OR_CLEAR, CREATE } |
typedef vtkSQLDatabase | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
void | Close () |
bool | IsOpen () |
vtkSQLQuery * | GetQueryInstance () |
vtkStringArray * | GetTables () |
vtkStringArray * | GetRecord (const char *table) |
bool | IsSupported (int feature) |
bool | HasError () |
const char * | GetLastErrorText () |
virtual vtkStdString | GetURL () |
bool | Open (const char *password) |
bool | Open (const char *password, int mode) |
virtual char * | GetDatabaseType () |
virtual char * | GetDatabaseFileName () |
virtual void | SetDatabaseFileName (const char *) |
virtual vtkStdString | GetColumnSpecification (vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle) |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkSQLiteDatabase * | SafeDownCast (vtkObject *o) |
static vtkSQLiteDatabase * | New () |
Protected Member Functions | |
vtkSQLiteDatabase () | |
~vtkSQLiteDatabase () | |
virtual bool | ParseURL (const char *url) |
Friends | |
class | vtkSQLiteQuery |
anonymous enum |
Definition at line 73 of file vtkSQLiteDatabase.h.
vtkSQLiteDatabase::vtkSQLiteDatabase | ( | ) | [protected] |
vtkSQLiteDatabase::~vtkSQLiteDatabase | ( | ) | [protected] |
virtual const char* vtkSQLiteDatabase::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkSQLDatabase.
static int vtkSQLiteDatabase::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkSQLDatabase.
virtual int vtkSQLiteDatabase::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkSQLDatabase.
static vtkSQLiteDatabase* vtkSQLiteDatabase::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkSQLDatabase.
void vtkSQLiteDatabase::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkSQLDatabase.
static vtkSQLiteDatabase* vtkSQLiteDatabase::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
bool vtkSQLiteDatabase::Open | ( | const char * | password | ) | [virtual] |
Open a new connection to the database. You need to set the filename before calling this function. Returns true if the database was opened successfully; false otherwise. - USE_EXISTING (default) - Fail if the file does not exist. - USE_EXISTING_OR_CREATE - Create a new file if necessary. - CREATE_OR_CLEAR - Create new or clear existing file. - CREATE - Create new, fail if file exists.
Implements vtkSQLDatabase.
bool vtkSQLiteDatabase::Open | ( | const char * | password, | |
int | mode | |||
) |
Open a new connection to the database. You need to set the filename before calling this function. Returns true if the database was opened successfully; false otherwise. - USE_EXISTING (default) - Fail if the file does not exist. - USE_EXISTING_OR_CREATE - Create a new file if necessary. - CREATE_OR_CLEAR - Create new or clear existing file. - CREATE - Create new, fail if file exists.
void vtkSQLiteDatabase::Close | ( | ) | [virtual] |
Close the connection to the database.
Implements vtkSQLDatabase.
bool vtkSQLiteDatabase::IsOpen | ( | ) | [virtual] |
Return whether the database has an open connection
Implements vtkSQLDatabase.
vtkSQLQuery* vtkSQLiteDatabase::GetQueryInstance | ( | ) | [virtual] |
Return an empty query on this database.
Implements vtkSQLDatabase.
vtkStringArray* vtkSQLiteDatabase::GetTables | ( | ) | [virtual] |
Get the list of tables from the database
Implements vtkSQLDatabase.
vtkStringArray* vtkSQLiteDatabase::GetRecord | ( | const char * | table | ) | [virtual] |
Get the list of fields for a particular table
Implements vtkSQLDatabase.
bool vtkSQLiteDatabase::IsSupported | ( | int | feature | ) |
Return whether a feature is supported by the database.
bool vtkSQLiteDatabase::HasError | ( | ) | [virtual] |
Did the last operation generate an error
Implements vtkSQLDatabase.
const char* vtkSQLiteDatabase::GetLastErrorText | ( | ) | [virtual] |
Get the last error text from the database
Implements vtkSQLDatabase.
virtual char* vtkSQLiteDatabase::GetDatabaseType | ( | ) | [virtual] |
String representing database type (e.g. "sqlite").
Implements vtkSQLDatabase.
virtual char* vtkSQLiteDatabase::GetDatabaseFileName | ( | ) | [virtual] |
String representing the database filename.
virtual void vtkSQLiteDatabase::SetDatabaseFileName | ( | const char * | ) | [virtual] |
String representing the database filename.
virtual vtkStdString vtkSQLiteDatabase::GetURL | ( | ) | [virtual] |
Get the URL of the database.
Implements vtkSQLDatabase.
virtual vtkStdString vtkSQLiteDatabase::GetColumnSpecification | ( | vtkSQLDatabaseSchema * | schema, | |
int | tblHandle, | |||
int | colHandle | |||
) | [virtual] |
Return the SQL string with the syntax to create a column inside a "CREATE TABLE" SQL statement. NB: this method implements the SQLite-specific syntax: <column name>=""> <column type>=""> <column attributes>="">
Reimplemented from vtkSQLDatabase.
virtual bool vtkSQLiteDatabase::ParseURL | ( | const char * | url | ) | [protected, virtual] |
Overridden to determine connection paramters given the URL. This is called by CreateFromURL() to initialize the instance. Look at CreateFromURL() for details about the URL format.
Implements vtkSQLDatabase.
friend class vtkSQLiteQuery [friend] |
Definition at line 64 of file vtkSQLiteDatabase.h.