Go to the documentation of this file.
46 #ifndef vtkSQLDatabaseSchema_h
47 #define vtkSQLDatabaseSchema_h
49 #include "vtkIOSQLModule.h"
57 #define VTK_SQL_ALLBACKENDS "*" // works for all backends
58 #define VTK_SQL_MYSQL "vtkMySQLDatabase"
59 #define VTK_SQL_POSTGRESQL "vtkPostgreSQLDatabase"
60 #define VTK_SQL_SQLITE "vtkSQLiteDatabase"
62 class vtkSQLDatabaseSchemaInternals;
131 const char* preName,
const char* preAction,
146 int tblHandle,
int colType,
const char* colName,
147 int colSize,
const char* colAttribs );
149 const char* tblName,
int colType,
const char* colName,
150 int colSize,
const char* colAttribs )
152 return this->AddColumnToTable( this->GetTableHandleFromName( tblName ),
153 colType, colName, colSize, colAttribs );
164 int tblHandle,
int idxType,
const char* idxName );
166 const char* tblName,
int idxType,
const char* idxName )
168 return this->AddIndexToTable( this->GetTableHandleFromName( tblName ),
181 const char* tblName,
const char* idxName,
const char* colName )
183 int tblHandle = this->GetTableHandleFromName( tblName );
184 return this->AddColumnToIndex( tblHandle,
185 this->GetIndexHandleFromName( tblName, idxName ),
186 this->GetColumnHandleFromName( tblName, colName ) );
198 int tblHandle,
int trgType,
const char* trgName,
201 const char* tblName,
int trgType,
const char* trgName,
204 return this->AddTriggerToTable( this->GetTableHandleFromName( tblName ),
205 trgType, trgName, trgAction, trgBackend );
222 int tblHandle,
const char* optStr,
225 const char* tblName,
const char* optStr,
228 return this->AddOptionToTable( this->GetTableHandleFromName( tblName ),
229 optStr, optBackend );
282 int tblHandle,
int idxHandle,
int cnmHandle );
388 vtkSetStringMacro(Name);
397 INDEX_COLUMN_TOKEN = 65,
398 END_INDEX_TOKEN = 75,
448 #endif // vtkSQLDatabaseSchema_h
virtual int AddColumnToIndex(const char *tblName, const char *idxName, const char *colName)
virtual int AddTriggerToTable(const char *tblName, int trgType, const char *trgName, const char *trgAction, const char *trgBackend=VTK_SQL_ALLBACKENDS)
int GetIndexTypeFromHandle(int tblHandle, int idxHandle)
Given the handles of a table and an index, get the type of the index.
int GetNumberOfPreambles()
Get the number of preambles.
const char * GetPreambleActionFromHandle(int preHandle)
Given a preamble handle, get its action.
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 languag...
int GetNumberOfIndicesInTable(int tblHandle)
Get the number of indices in a particular table .
int GetPreambleHandleFromName(const char *preName)
Given a preamble name, get its handle.
void Reset()
Reset the schema to its initial, empty state.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
const char * GetPreambleNameFromHandle(int preHandle)
Given a preamble handle, get its name.
int GetTableHandleFromName(const char *tblName)
Given a table name, get its handle.
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.
DatabaseTriggerType
Events where database triggers can be registered.
DatabaseColumnType
Basic data types for database columns.
virtual int AddTable(const char *tblName)
Add a table to the schema.
abstract base class for most VTK objects
const char * GetOptionTextFromHandle(int tblHandle, int optHandle)
Given the handles of a table and one of its options, return the text of the option.
int GetColumnTypeFromHandle(int tblHandle, int colHandle)
Given the handles of a table and a column, get the type of the column.
const char * GetOptionBackendFromHandle(int tblHandle, int trgHandle)
Given the handles of a table and one of its options, get the backend of the option.
int GetNumberOfOptionsInTable(int tblHandle)
Get the number of options associated with a particular table.
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.
int GetTriggerTypeFromHandle(int tblHandle, int trgHandle)
Given the handles of a table and a trigger, get the type of the trigger.
DatabaseIndexType
Types of indices that can be generated for database tables.
static vtkSQLDatabaseSchema * New()
virtual int AddColumnToTable(const char *tblName, int colType, const char *colName, int colSize, const char *colAttribs)
int GetNumberOfTables()
Get the number of tables.
virtual int AddIndexToTable(const char *tblName, int idxType, const char *idxName)
virtual int AddIndexToTable(int tblHandle, int idxType, const char *idxName)
Add an index to table.
virtual int AddOptionToTable(const char *tblName, const char *optStr, const char *optBackend=VTK_SQL_ALLBACKENDS)
int GetColumnSizeFromHandle(int tblHandle, int colHandle)
Given the handles of a table and a column, get the size of the column.
int GetNumberOfColumnNamesInIndex(int tblHandle, int idxHandle)
Get the number of column names associated to a particular index in a particular table .
a simple class to control print indentation
const char * GetTriggerBackendFromHandle(int tblHandle, int trgHandle)
Given the handles of a table and a trigger, get the backend of the trigger.
class vtkSQLDatabaseSchemaInternals * Internals
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
const char * GetTriggerNameFromHandle(int tblHandle, int trgHandle)
Given the handles of a table and a trigger, get the name of the trigger.
const char * GetColumnAttributesFromHandle(int tblHandle, int colHandle)
Given the handles of a table and a column, get the attributes of the column.
int AddTableMultipleArguments(const char *tblName,...)
An unwrappable but useful routine to construct built-in schema.
represent an SQL database schema
#define VTK_SQL_ALLBACKENDS
int GetNumberOfTriggersInTable(int tblHandle)
Get the number of triggers defined for a particular table.
const char * GetColumnNameFromHandle(int tblHandle, int colHandle)
Given the handles of a table and a column, get the name of the column.
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.
virtual int AddColumnToIndex(int tblHandle, int idxHandle, int colHandle)
Add a column to a table index.
const char * GetIndexNameFromHandle(int tblHandle, int idxHandle)
Given the handles of a table and an index, get the name of the index.
const char * GetTableNameFromHandle(int tblHandle)
Given a table hanlde, get its name.
virtual int AddColumnToTable(int tblHandle, int colType, const char *colName, int colSize, const char *colAttribs)
Add a column to table.
int GetNumberOfColumnsInTable(int tblHandle)
Get the number of columns in a particular table .
const char * GetTriggerActionFromHandle(int tblHandle, int trgHandle)
Given the handles of a table and a trigger, get the action of the trigger.
virtual int AddOptionToTable(int tblHandle, const char *optStr, const char *optBackend=VTK_SQL_ALLBACKENDS)
Add (possibly backend-specific) text to the end of a CREATE TABLE (...) statement.
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.
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.
const char * GetPreambleBackendFromHandle(int preHandle)
Given a preamble handle, get its backend.