VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
vtkSQLiteDatabase Class Reference

maintain a connection to an SQLite database More...

#include <vtkSQLiteDatabase.h>

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

Public Types

enum  { USE_EXISTING, USE_EXISTING_OR_CREATE, CREATE_OR_CLEAR, CREATE }
 
typedef vtkSQLDatabase Superclass
 
- Public Types inherited from vtkSQLDatabase
typedef vtkObject Superclass
 
typedef vtkSQLDatabase *(* CreateFunction) (const char *URL)
 
- Public Types inherited from vtkObject
typedef vtkObjectBase 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)
 
- Public Member Functions inherited from vtkSQLDatabase
vtkSQLDatabaseNewInstance () const
 
virtual bool IsSupported (int vtkNotUsed(feature))
 
virtual vtkStdString GetTablePreamble (bool)
 
virtual bool EffectSchema (vtkSQLDatabaseSchema *, bool dropIfExists=false)
 
virtual vtkStdString GetIndexSpecification (vtkSQLDatabaseSchema *schema, int tblHandle, int idxHandle, bool &skipped)
 
virtual vtkStdString GetTriggerSpecification (vtkSQLDatabaseSchema *schema, int tblHandle, int trgHandle)
 
- Public Member Functions inherited from vtkObject
vtkObjectNewInstance () const
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual unsigned long GetMTime ()
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkSQLiteDatabaseSafeDownCast (vtkObjectBase *o)
 
static vtkSQLiteDatabaseNew ()
 
- Static Public Member Functions inherited from vtkSQLDatabase
static int IsTypeOf (const char *type)
 
static vtkSQLDatabaseSafeDownCast (vtkObjectBase *o)
 
static vtkSQLDatabaseCreateFromURL (const char *URL)
 
static vtkInformationObjectBaseKeyDATABASE ()
 
static void RegisterCreateFromURLCallback (CreateFunction callback)
 
static void UnRegisterCreateFromURLCallback (CreateFunction callback)
 
static void UnRegisterAllCreateFromURLCallbacks ()
 
- Static Public Member Functions inherited from vtkObject
static int IsTypeOf (const char *type)
 
static vtkObjectSafeDownCast (vtkObjectBase *o)
 
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static int IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkSQLiteDatabase ()
 
 ~vtkSQLiteDatabase ()
 
virtual bool ParseURL (const char *url)
 
- Protected Member Functions inherited from vtkSQLDatabase
 vtkSQLDatabase ()
 
 ~vtkSQLDatabase ()
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
virtual void RegisterInternal (vtkObjectBase *, int check)
 
virtual void UnRegisterInternal (vtkObjectBase *, int check)
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Friends

class vtkSQLiteQuery
 

Additional Inherited Members

- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

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

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

vtkSQLiteDatabase::vtkSQLiteDatabase ( )
protected
vtkSQLiteDatabase::~vtkSQLiteDatabase ( )
protected

Member Function Documentation

static int vtkSQLiteDatabase::IsTypeOf ( const char *  type)
static
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 ( vtkObjectBase o)
static
virtual vtkObjectBase* vtkSQLiteDatabase::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkSQLDatabase.

vtkSQLiteDatabase* vtkSQLiteDatabase::NewInstance ( ) const
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
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)
protectedvirtual

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: