VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
vtkSQLiteDatabase Class Reference

maintain a connection to an SQLite database More...

#include <vtkSQLiteDatabase.h>

Inheritance diagram for vtkSQLiteDatabase:
Inheritance graph
[legend]
Collaboration diagram for vtkSQLiteDatabase:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { USE_EXISTING, USE_EXISTING_OR_CREATE, CREATE_OR_CLEAR, CREATE }
typedef vtkSQLDatabase Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkSQLiteDatabaseNewInstance () const
void PrintSelf (ostream &os, vtkIndent indent)
void Close ()
bool IsOpen ()
vtkSQLQueryGetQueryInstance ()
vtkStringArrayGetTables ()
vtkStringArrayGetRecord (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 vtkSQLiteDatabaseSafeDownCast (vtkObjectBase *o)
static vtkSQLiteDatabaseNew ()

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 vtkSQLiteDatabase ()
 ~vtkSQLiteDatabase ()
virtual bool ParseURL (const char *url)

Friends

class vtkSQLiteQuery

Detailed Description

maintain a connection to an SQLite database

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>'.

Thanks:
Thanks to Andrew Wilson and Philippe Pebay from Sandia National Laboratories for implementing this class.
See also:
vtkSQLiteQuery
Examples:
vtkSQLiteDatabase (Examples)
Tests:
vtkSQLiteDatabase (Tests)

Definition at line 62 of file vtkSQLiteDatabase.h.


Member Typedef Documentation

Reimplemented from vtkSQLDatabase.

Definition at line 69 of file vtkSQLiteDatabase.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
USE_EXISTING 
USE_EXISTING_OR_CREATE 
CREATE_OR_CLEAR 
CREATE 

Definition at line 74 of file vtkSQLiteDatabase.h.


Constructor & Destructor Documentation


Member Function Documentation

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.

Reimplemented from vtkSQLDatabase.

virtual vtkObjectBase* vtkSQLiteDatabase::NewInstanceInternal ( ) const [protected, virtual]

Reimplemented from vtkSQLDatabase.

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.

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.

Return an empty query on this database.

Implements vtkSQLDatabase.

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.

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 parameters given the URL. This is called by CreateFromURL() to initialize the instance. Look at CreateFromURL() for details about the URL format.

Implements vtkSQLDatabase.


Friends And Related Function Documentation

friend class vtkSQLiteQuery [friend]

Definition at line 65 of file vtkSQLiteDatabase.h.


The documentation for this class was generated from the following file: