VTK  9.3.20240327
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkSQLDatabaseSchema Class Reference

represent an SQL database schema More...

#include <vtkSQLDatabaseSchema.h>

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

Public Types

enum  DatabaseColumnType {
  SERIAL = 0 , SMALLINT = 1 , INTEGER = 2 , BIGINT = 3 ,
  VARCHAR = 4 , TEXT = 5 , REAL = 6 , DOUBLE = 7 ,
  BLOB = 8 , TIME = 9 , DATE = 10 , TIMESTAMP = 11
}
 Basic data types for database columns. More...
 
enum  DatabaseIndexType { INDEX = 0 , UNIQUE = 1 , PRIMARY_KEY = 2 }
 Types of indices that can be generated for database tables. More...
 
enum  DatabaseTriggerType {
  BEFORE_INSERT = 0 , AFTER_INSERT = 1 , BEFORE_UPDATE = 2 , AFTER_UPDATE = 3 ,
  BEFORE_DELETE = 4 , AFTER_DELETE = 5
}
 Events where database triggers can be registered. More...
 
enum  VarargTokens {
  COLUMN_TOKEN = 58 , INDEX_TOKEN = 63 , INDEX_COLUMN_TOKEN = 65 , END_INDEX_TOKEN = 75 ,
  TRIGGER_TOKEN = 81 , OPTION_TOKEN = 86 , END_TABLE_TOKEN = 99
}
 
typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkSQLDatabaseSchemaNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual int AddPreamble (const char *preName, const char *preAction, const char *preBackend=VTK_SQL_ALLBACKENDS)
 Add a preamble to the schema This can be used, in particular, to create functions and/or load languages in a backend-specific manner. More...
 
virtual int AddTable (const char *tblName)
 Add a table to the schema. More...
 
int GetPreambleHandleFromName (const char *preName)
 Given a preamble name, get its handle. More...
 
const char * GetPreambleNameFromHandle (int preHandle)
 Given a preamble handle, get its name. More...
 
const char * GetPreambleActionFromHandle (int preHandle)
 Given a preamble handle, get its action. More...
 
const char * GetPreambleBackendFromHandle (int preHandle)
 Given a preamble handle, get its backend. More...
 
int GetTableHandleFromName (const char *tblName)
 Given a table name, get its handle. More...
 
const char * GetTableNameFromHandle (int tblHandle)
 Given a table handle, get its name. More...
 
int GetIndexHandleFromName (const char *tblName, const char *idxName)
 Given the names of a table and an index, get the handle of the index in this table. More...
 
const char * GetIndexNameFromHandle (int tblHandle, int idxHandle)
 Given the handles of a table and an index, get the name of the index. More...
 
int GetIndexTypeFromHandle (int tblHandle, int idxHandle)
 Given the handles of a table and an index, get the type of the index. More...
 
const char * GetIndexColumnNameFromHandle (int tblHandle, int idxHandle, int cnmHandle)
 Given the handles of a table, an index, and a column name, get the column name. More...
 
int GetColumnHandleFromName (const char *tblName, const char *colName)
 Given the names of a table and a column, get the handle of the column in this table. More...
 
const char * GetColumnNameFromHandle (int tblHandle, int colHandle)
 Given the handles of a table and a column, get the name of the column. More...
 
int GetColumnTypeFromHandle (int tblHandle, int colHandle)
 Given the handles of a table and a column, get the type of the column. More...
 
int GetColumnSizeFromHandle (int tblHandle, int colHandle)
 Given the handles of a table and a column, get the size of the column. More...
 
const char * GetColumnAttributesFromHandle (int tblHandle, int colHandle)
 Given the handles of a table and a column, get the attributes of the column. More...
 
int GetTriggerHandleFromName (const char *tblName, const char *trgName)
 Given the names of a trigger and a table, get the handle of the trigger in this table. More...
 
const char * GetTriggerNameFromHandle (int tblHandle, int trgHandle)
 Given the handles of a table and a trigger, get the name of the trigger. More...
 
int GetTriggerTypeFromHandle (int tblHandle, int trgHandle)
 Given the handles of a table and a trigger, get the type of the trigger. More...
 
const char * GetTriggerActionFromHandle (int tblHandle, int trgHandle)
 Given the handles of a table and a trigger, get the action of the trigger. More...
 
const char * GetTriggerBackendFromHandle (int tblHandle, int trgHandle)
 Given the handles of a table and a trigger, get the backend of the trigger. More...
 
const char * GetOptionTextFromHandle (int tblHandle, int optHandle)
 Given the handles of a table and one of its options, return the text of the option. More...
 
const char * GetOptionBackendFromHandle (int tblHandle, int optHandle)
 Given the handles of a table and one of its options, get the backend of the option. More...
 
void Reset ()
 Reset the schema to its initial, empty state. More...
 
int GetNumberOfPreambles ()
 Get the number of preambles. More...
 
int GetNumberOfTables ()
 Get the number of tables. More...
 
int GetNumberOfColumnsInTable (int tblHandle)
 Get the number of columns in a particular table . More...
 
int GetNumberOfIndicesInTable (int tblHandle)
 Get the number of indices in a particular table . More...
 
int GetNumberOfColumnNamesInIndex (int tblHandle, int idxHandle)
 Get the number of column names associated to a particular index in a particular table . More...
 
int GetNumberOfTriggersInTable (int tblHandle)
 Get the number of triggers defined for a particular table. More...
 
int GetNumberOfOptionsInTable (int tblHandle)
 Get the number of options associated with a particular table. More...
 
int AddTableMultipleArguments (const char *tblName,...)
 An unwrappable but useful routine to construct built-in schema. More...
 
virtual int AddColumnToTable (int tblHandle, int colType, const char *colName, int colSize, const char *colOpts)
 Add a column to table. More...
 
virtual int AddColumnToTable (const char *tblName, int colType, const char *colName, int colSize, const char *colAttribs)
 Add a column to table. More...
 
virtual int AddIndexToTable (int tblHandle, int idxType, const char *idxName)
 Add an index to table. More...
 
virtual int AddIndexToTable (const char *tblName, int idxType, const char *idxName)
 Add an index to table. More...
 
virtual int AddColumnToIndex (int tblHandle, int idxHandle, int colHandle)
 Add a column to a table index. More...
 
virtual int AddColumnToIndex (const char *tblName, const char *idxName, const char *colName)
 Add a column to a table index. More...
 
virtual int AddTriggerToTable (int tblHandle, int trgType, const char *trgName, const char *trgAction, const char *trgBackend=VTK_SQL_ALLBACKENDS)
 Add a (possibly backend-specific) trigger action to a table. More...
 
virtual int AddTriggerToTable (const char *tblName, int trgType, const char *trgName, const char *trgAction, const char *trgBackend=VTK_SQL_ALLBACKENDS)
 Add a (possibly backend-specific) trigger action to a table. More...
 
virtual int AddOptionToTable (int tblHandle, const char *optText, const char *optBackend=VTK_SQL_ALLBACKENDS)
 Add (possibly backend-specific) text to the end of a CREATE TABLE (...) statement. More...
 
virtual int AddOptionToTable (const char *tblName, const char *optStr, const char *optBackend=VTK_SQL_ALLBACKENDS)
 Add (possibly backend-specific) text to the end of a CREATE TABLE (...) statement. More...
 
virtual void SetName (const char *)
 Set/Get the name of the schema. More...
 
virtual char * GetName ()
 Set/Get the name of the schema. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
vtkTypeBool InvokeEvent (unsigned long event)
 
vtkTypeBool InvokeEvent (const char *event)
 
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes. More...
 
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes. More...
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not. More...
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkSQLDatabaseSchemaSafeDownCast (vtkObjectBase *o)
 
static vtkSQLDatabaseSchemaNew ()
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (vtkTypeBool val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static vtkTypeBool GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. More...
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkSQLDatabaseSchema ()
 
 ~vtkSQLDatabaseSchema () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events. More...
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

char * Name
 
class vtkSQLDatabaseSchemaInternals * Internals
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
std::string ObjectName
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

represent an SQL database schema

This class stores the information required to create an SQL database from scratch. Information on each table's columns, indices, and triggers is stored. You may also store an arbitrary number of preamble statements, intended to be executed before any tables are created; this provides a way to create procedures or functions that may be invoked as part of a trigger action. Triggers and table options may be specified differently for each backend database type you wish to support.

Thanks:
Thanks to Philippe Pebay and David Thompson from Sandia National Laboratories for implementing this class.
See also
vtkSQLDatabase
Tests:
vtkSQLDatabaseSchema (Tests)

Definition at line 49 of file vtkSQLDatabaseSchema.h.

Member Typedef Documentation

◆ Superclass

Definition at line 52 of file vtkSQLDatabaseSchema.h.

Member Enumeration Documentation

◆ DatabaseColumnType

Basic data types for database columns.

Enumerator
SERIAL 
SMALLINT 
INTEGER 
BIGINT 
VARCHAR 
TEXT 
REAL 
DOUBLE 
BLOB 
TIME 
DATE 
TIMESTAMP 

Definition at line 59 of file vtkSQLDatabaseSchema.h.

◆ DatabaseIndexType

Types of indices that can be generated for database tables.

Enumerator
INDEX 
UNIQUE 
PRIMARY_KEY 

Definition at line 78 of file vtkSQLDatabaseSchema.h.

◆ DatabaseTriggerType

Events where database triggers can be registered.

Enumerator
BEFORE_INSERT 
AFTER_INSERT 
BEFORE_UPDATE 
AFTER_UPDATE 
BEFORE_DELETE 
AFTER_DELETE 

Definition at line 90 of file vtkSQLDatabaseSchema.h.

◆ VarargTokens

Enumerator
COLUMN_TOKEN 
INDEX_TOKEN 
INDEX_COLUMN_TOKEN 
END_INDEX_TOKEN 
TRIGGER_TOKEN 
OPTION_TOKEN 
END_TABLE_TOKEN 

Definition at line 363 of file vtkSQLDatabaseSchema.h.

Constructor & Destructor Documentation

◆ vtkSQLDatabaseSchema()

vtkSQLDatabaseSchema::vtkSQLDatabaseSchema ( )
protected

◆ ~vtkSQLDatabaseSchema()

vtkSQLDatabaseSchema::~vtkSQLDatabaseSchema ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkSQLDatabaseSchema::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkSQLDatabaseSchema::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 vtkObjectBase.

◆ SafeDownCast()

static vtkSQLDatabaseSchema* vtkSQLDatabaseSchema::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkSQLDatabaseSchema::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkSQLDatabaseSchema* vtkSQLDatabaseSchema::NewInstance ( ) const

◆ PrintSelf()

void vtkSQLDatabaseSchema::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

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

◆ New()

static vtkSQLDatabaseSchema* vtkSQLDatabaseSchema::New ( )
static

◆ AddPreamble()

virtual int vtkSQLDatabaseSchema::AddPreamble ( const char *  preName,
const char *  preAction,
const char *  preBackend = VTK_SQL_ALLBACKENDS 
)
virtual

Add a preamble to the schema This can be used, in particular, to create functions and/or load languages in a backend-specific manner.

Example usage: vtkSQLDatabaseSchema* schema = vtkSQLDatabaseSchema::New(); schema->SetName( "Example" ); schema->AddPreamble( "dropPLPGSQL", "DROP LANGUAGE IF EXISTS PLPGSQL CASCADE", VTK_SQL_POSTGRESQL ); schema->AddPreamble( "loadPLPGSQL", "CREATE LANGUAGE PLPGSQL", VTK_SQL_POSTGRESQL ); schema->AddPreamble( "createsomefunction", "CREATE OR REPLACE FUNCTION somefunction() RETURNS TRIGGER AS $btable$ " "BEGIN " "INSERT INTO btable (somevalue) VALUES (NEW.somenmbr); " "RETURN NEW; " "END; $btable$ LANGUAGE PLPGSQL", VTK_SQL_POSTGRESQL );

◆ AddTable()

virtual int vtkSQLDatabaseSchema::AddTable ( const char *  tblName)
virtual

Add a table to the schema.

◆ AddColumnToTable() [1/2]

virtual int vtkSQLDatabaseSchema::AddColumnToTable ( int  tblHandle,
int  colType,
const char *  colName,
int  colSize,
const char *  colOpts 
)
virtual

Add a column to table.

The returned value is a column handle or -1 if an error occurred.

◆ AddColumnToTable() [2/2]

virtual int vtkSQLDatabaseSchema::AddColumnToTable ( const char *  tblName,
int  colType,
const char *  colName,
int  colSize,
const char *  colAttribs 
)
inlinevirtual

Add a column to table.

The returned value is a column handle or -1 if an error occurred.

Definition at line 129 of file vtkSQLDatabaseSchema.h.

◆ AddIndexToTable() [1/2]

virtual int vtkSQLDatabaseSchema::AddIndexToTable ( int  tblHandle,
int  idxType,
const char *  idxName 
)
virtual

Add an index to table.

The returned value is an index handle or -1 if an error occurred.

◆ AddIndexToTable() [2/2]

virtual int vtkSQLDatabaseSchema::AddIndexToTable ( const char *  tblName,
int  idxType,
const char *  idxName 
)
inlinevirtual

Add an index to table.

The returned value is an index handle or -1 if an error occurred.

Definition at line 144 of file vtkSQLDatabaseSchema.h.

◆ AddColumnToIndex() [1/2]

virtual int vtkSQLDatabaseSchema::AddColumnToIndex ( int  tblHandle,
int  idxHandle,
int  colHandle 
)
virtual

Add a column to a table index.

The returned value is an index-column handle or -1 if an error occurred.

◆ AddColumnToIndex() [2/2]

virtual int vtkSQLDatabaseSchema::AddColumnToIndex ( const char *  tblName,
const char *  idxName,
const char *  colName 
)
inlinevirtual

Add a column to a table index.

The returned value is an index-column handle or -1 if an error occurred.

Definition at line 157 of file vtkSQLDatabaseSchema.h.

◆ AddTriggerToTable() [1/2]

virtual int vtkSQLDatabaseSchema::AddTriggerToTable ( int  tblHandle,
int  trgType,
const char *  trgName,
const char *  trgAction,
const char *  trgBackend = VTK_SQL_ALLBACKENDS 
)
virtual

Add a (possibly backend-specific) trigger action to a table.

Triggers must be given unique, non-nullptr names as some database backends require them. The returned value is a trigger handle or -1 if an error occurred.

◆ AddTriggerToTable() [2/2]

virtual int vtkSQLDatabaseSchema::AddTriggerToTable ( const char *  tblName,
int  trgType,
const char *  trgName,
const char *  trgAction,
const char *  trgBackend = VTK_SQL_ALLBACKENDS 
)
inlinevirtual

Add a (possibly backend-specific) trigger action to a table.

Triggers must be given unique, non-nullptr names as some database backends require them. The returned value is a trigger handle or -1 if an error occurred.

Definition at line 174 of file vtkSQLDatabaseSchema.h.

◆ AddOptionToTable() [1/2]

virtual int vtkSQLDatabaseSchema::AddOptionToTable ( int  tblHandle,
const char *  optText,
const char *  optBackend = VTK_SQL_ALLBACKENDS 
)
virtual

Add (possibly backend-specific) text to the end of a CREATE TABLE (...) statement.

This is most useful for specifying storage semantics of tables that are specific to the backend. For example, table options can be used to specify the TABLESPACE of a PostgreSQL table or the ENGINE of a MySQL table.

The returned value is an option handle or -1 if an error occurred.

◆ AddOptionToTable() [2/2]

virtual int vtkSQLDatabaseSchema::AddOptionToTable ( const char *  tblName,
const char *  optStr,
const char *  optBackend = VTK_SQL_ALLBACKENDS 
)
inlinevirtual

Add (possibly backend-specific) text to the end of a CREATE TABLE (...) statement.

This is most useful for specifying storage semantics of tables that are specific to the backend. For example, table options can be used to specify the TABLESPACE of a PostgreSQL table or the ENGINE of a MySQL table.

The returned value is an option handle or -1 if an error occurred.

Definition at line 196 of file vtkSQLDatabaseSchema.h.

◆ GetPreambleHandleFromName()

int vtkSQLDatabaseSchema::GetPreambleHandleFromName ( const char *  preName)

Given a preamble name, get its handle.

◆ GetPreambleNameFromHandle()

const char* vtkSQLDatabaseSchema::GetPreambleNameFromHandle ( int  preHandle)

Given a preamble handle, get its name.

◆ GetPreambleActionFromHandle()

const char* vtkSQLDatabaseSchema::GetPreambleActionFromHandle ( int  preHandle)

Given a preamble handle, get its action.

◆ GetPreambleBackendFromHandle()

const char* vtkSQLDatabaseSchema::GetPreambleBackendFromHandle ( int  preHandle)

Given a preamble handle, get its backend.

◆ GetTableHandleFromName()

int vtkSQLDatabaseSchema::GetTableHandleFromName ( const char *  tblName)

Given a table name, get its handle.

◆ GetTableNameFromHandle()

const char* vtkSQLDatabaseSchema::GetTableNameFromHandle ( int  tblHandle)

Given a table handle, get its name.

◆ GetIndexHandleFromName()

int vtkSQLDatabaseSchema::GetIndexHandleFromName ( const char *  tblName,
const char *  idxName 
)

Given the names of a table and an index, get the handle of the index in this table.

◆ GetIndexNameFromHandle()

const char* vtkSQLDatabaseSchema::GetIndexNameFromHandle ( int  tblHandle,
int  idxHandle 
)

Given the handles of a table and an index, get the name of the index.

◆ GetIndexTypeFromHandle()

int vtkSQLDatabaseSchema::GetIndexTypeFromHandle ( int  tblHandle,
int  idxHandle 
)

Given the handles of a table and an index, get the type of the index.

◆ GetIndexColumnNameFromHandle()

const char* vtkSQLDatabaseSchema::GetIndexColumnNameFromHandle ( int  tblHandle,
int  idxHandle,
int  cnmHandle 
)

Given the handles of a table, an index, and a column name, get the column name.

◆ GetColumnHandleFromName()

int vtkSQLDatabaseSchema::GetColumnHandleFromName ( const char *  tblName,
const char *  colName 
)

Given the names of a table and a column, get the handle of the column in this table.

◆ GetColumnNameFromHandle()

const char* vtkSQLDatabaseSchema::GetColumnNameFromHandle ( int  tblHandle,
int  colHandle 
)

Given the handles of a table and a column, get the name of the column.

◆ GetColumnTypeFromHandle()

int vtkSQLDatabaseSchema::GetColumnTypeFromHandle ( int  tblHandle,
int  colHandle 
)

Given the handles of a table and a column, get the type of the column.

◆ GetColumnSizeFromHandle()

int vtkSQLDatabaseSchema::GetColumnSizeFromHandle ( int  tblHandle,
int  colHandle 
)

Given the handles of a table and a column, get the size of the column.

◆ GetColumnAttributesFromHandle()

const char* vtkSQLDatabaseSchema::GetColumnAttributesFromHandle ( int  tblHandle,
int  colHandle 
)

Given the handles of a table and a column, get the attributes of the column.

◆ GetTriggerHandleFromName()

int vtkSQLDatabaseSchema::GetTriggerHandleFromName ( const char *  tblName,
const char *  trgName 
)

Given the names of a trigger and a table, get the handle of the trigger in this table.

◆ GetTriggerNameFromHandle()

const char* vtkSQLDatabaseSchema::GetTriggerNameFromHandle ( int  tblHandle,
int  trgHandle 
)

Given the handles of a table and a trigger, get the name of the trigger.

◆ GetTriggerTypeFromHandle()

int vtkSQLDatabaseSchema::GetTriggerTypeFromHandle ( int  tblHandle,
int  trgHandle 
)

Given the handles of a table and a trigger, get the type of the trigger.

◆ GetTriggerActionFromHandle()

const char* vtkSQLDatabaseSchema::GetTriggerActionFromHandle ( int  tblHandle,
int  trgHandle 
)

Given the handles of a table and a trigger, get the action of the trigger.

◆ GetTriggerBackendFromHandle()

const char* vtkSQLDatabaseSchema::GetTriggerBackendFromHandle ( int  tblHandle,
int  trgHandle 
)

Given the handles of a table and a trigger, get the backend of the trigger.

◆ GetOptionTextFromHandle()

const char* vtkSQLDatabaseSchema::GetOptionTextFromHandle ( int  tblHandle,
int  optHandle 
)

Given the handles of a table and one of its options, return the text of the option.

◆ GetOptionBackendFromHandle()

const char* vtkSQLDatabaseSchema::GetOptionBackendFromHandle ( int  tblHandle,
int  optHandle 
)

Given the handles of a table and one of its options, get the backend of the option.

◆ Reset()

void vtkSQLDatabaseSchema::Reset ( )

Reset the schema to its initial, empty state.

◆ GetNumberOfPreambles()

int vtkSQLDatabaseSchema::GetNumberOfPreambles ( )

Get the number of preambles.

◆ GetNumberOfTables()

int vtkSQLDatabaseSchema::GetNumberOfTables ( )

Get the number of tables.

◆ GetNumberOfColumnsInTable()

int vtkSQLDatabaseSchema::GetNumberOfColumnsInTable ( int  tblHandle)

Get the number of columns in a particular table .

◆ GetNumberOfIndicesInTable()

int vtkSQLDatabaseSchema::GetNumberOfIndicesInTable ( int  tblHandle)

Get the number of indices in a particular table .

◆ GetNumberOfColumnNamesInIndex()

int vtkSQLDatabaseSchema::GetNumberOfColumnNamesInIndex ( int  tblHandle,
int  idxHandle 
)

Get the number of column names associated to a particular index in a particular table .

◆ GetNumberOfTriggersInTable()

int vtkSQLDatabaseSchema::GetNumberOfTriggersInTable ( int  tblHandle)

Get the number of triggers defined for a particular table.

◆ GetNumberOfOptionsInTable()

int vtkSQLDatabaseSchema::GetNumberOfOptionsInTable ( int  tblHandle)

Get the number of options associated with a particular table.

◆ SetName()

virtual void vtkSQLDatabaseSchema::SetName ( const char *  )
virtual

Set/Get the name of the schema.

◆ GetName()

virtual char* vtkSQLDatabaseSchema::GetName ( )
virtual

Set/Get the name of the schema.

◆ AddTableMultipleArguments()

int vtkSQLDatabaseSchema::AddTableMultipleArguments ( const char *  tblName,
  ... 
)

An unwrappable but useful routine to construct built-in schema.

Example usage: int main() { vtkSQLDatabaseSchema* schema = vtkSQLDatabaseSchema::New(); schema->SetName( "Example" ); schema->AddTableMultipleArguments( "atable", vtkSQLDatabaseSchema::COLUMN_TOKEN, vtkSQLDatabaseSchema::INTEGER, "tablekey", 0, "", vtkSQLDatabaseSchema::COLUMN_TOKEN, vtkSQLDatabaseSchema::VARCHAR, "somename", 11, "NOT nullptr", vtkSQLDatabaseSchema::COLUMN_TOKEN, vtkSQLDatabaseSchema::BIGINT, "somenmbr", 17, "DEFAULT 0", vtkSQLDatabaseSchema::INDEX_TOKEN, vtkSQLDatabaseSchema::PRIMARY_KEY, "bigkey", vtkSQLDatabaseSchema::INDEX_COLUMN_TOKEN, "tablekey", vtkSQLDatabaseSchema::END_INDEX_TOKEN, vtkSQLDatabaseSchema::INDEX_TOKEN, vtkSQLDatabaseSchema::UNIQUE, "reverselookup", vtkSQLDatabaseSchema::INDEX_COLUMN_TOKEN, "somename", vtkSQLDatabaseSchema::INDEX_COLUMN_TOKEN, "somenmbr", vtkSQLDatabaseSchema::END_INDEX_TOKEN, vtkSQLDatabaseSchema::TRIGGER_TOKEN, vtkSQLDatabaseSchema::AFTER_INSERT, "InsertTrigger", "DO NOTHING", VTK_SQL_SQLITE, vtkSQLDatabaseSchema::TRIGGER_TOKEN, vtkSQLDatabaseSchema::AFTER_INSERT, "InsertTrigger", "FOR EACH ROW EXECUTE PROCEDURE somefunction ()", VTK_SQL_POSTGRESQL, vtkSQLDatabaseSchema::TRIGGER_TOKEN, vtkSQLDatabaseSchema::AFTER_INSERT, "InsertTrigger", "FOR EACH ROW INSERT INTO btable SET SomeValue = NEW.SomeNmbr", VTK_SQL_MYSQL, vtkSQLDatabaseSchema::END_TABLE_TOKEN ); return 0; }

Member Data Documentation

◆ Name

char* vtkSQLDatabaseSchema::Name
protected

Definition at line 409 of file vtkSQLDatabaseSchema.h.

◆ Internals

class vtkSQLDatabaseSchemaInternals* vtkSQLDatabaseSchema::Internals
protected

Definition at line 411 of file vtkSQLDatabaseSchema.h.


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