[vtk-developers] Re: vtkSQLDatabase
David C Thompson
dcthomp at sandia.gov
Wed Nov 28 15:50:59 EST 2007
Sebastien BARRE wrote:
> At 11/27/2007 07:57 PM, David C Thompson wrote:
> > > > 2. Adding enums to represent the various basic column storage types?
> > > > This is an area where SQL implementations vary significantly.
> > >
> > > I think this is a good idea modulo wrapping concerns (see below).
> >
> >I don't see any advantage that #define statements have over enums as far
> >as wrapping -- with the proper "//BTX ... //ETX" both get ignored by the
> >wrapper generate and anyone using Tcl, Python, etc. must have knowledge
> >of their values to use them. The only exceptions appear to be some
> >hand-coded values for the Python wrappers.
>
> Enums have usually more advantages than #define, so I'd say, go for
> enums,
OK
> ... but I also second Andy's opinion, be careful about wrapping,
> please do take into account that people will want to use this
> framework from Tcl, Python, etc, you can't just BTX/ETX.
OK. How about a class like this:
class vtkSQLDatabaseSchema : public vtkObject
{
public:
virtual int AddTable( const char* tableName );
virtual int AddColumnToTable( const char* tableName,
const char* colName, int colType, int colSize,
const char* colAttribs );
virtual int AddIndexToTable( const char* tableName,
const char* iName, int iType,
const char* foreignTableName=0, const char* foreignIndexName=0 );
virtual int AddColumnToIndex( const char* tableName,
const char* iName, const char* colName );
virtual int AddTriggerToTable( const char* tableName,
const char* tName, int tType, const char* tAction );
// ... and similar Get{Column,Index,Trigger} calls.
};
That could be wrapped and is a single class instead of one for Tables,
one for Columns, etc. Some extra macros in C++ (like those in my first
e-mail) would make it possible to declare a schema in a concise way.
David
More information about the vtk-developers
mailing list