[vtk-developers] Re: vtkSQLDatabase
David C Thompson
dcthomp at sandia.gov
Wed Nov 28 15:12:42 EST 2007
On Wed, 2007-11-28 at 12:46 -0700, Shead, Timothy wrote:
> > >> ...
> > >> // Returns an instance of vtkSQLiteDatabase
> > >> vtkSQLDatabase* db =
> > >> vtkSQLDatabase::CreateFromURL("sqlite:///home/tshead/mydb");
> > >> // Now what?
> > >> db->SetURL("mysql://tshead@localhost:3306/myotherdb");
> > >
> > > Alright, that makes sense now. I didn't pay close attention to the URL
> > > syntax, I didn't notice it had the db type in it.
> > > I'm not a huge fan of that CreateFromURL method, it looks kinda non-
> > > VTK-ish to me, but that's probably because I'm old-fashion VTK :)
> > Hmm, I got the idea from vtkDataArray::CreateDataArray( int
> > dataType ). :-)
>
> Perhaps a factory function for creating database instances based on URL
> doesn't go far enough ... maybe what you want is a
> "vtkUniversalSQLDatabase" object that can provide SetURL() / GetURL()
> functionality and use the underlying concrete databases as part of its
> implementation.
I think that falls under syntactic sugar. It would save having to call
Delete() and then CreateFromURL() when changing databases, but not
provide any change in performance (or perhaps a small decrease as each
call on the database would have to be forwarded to a concrete instance
if I understand your proposal correctly -- but I don't think it would be
a significant impact).
In any event, you've sold me on SetURL being protected. Unless Sebastien
is morally opposed to CreateFromURL (it didn't sound like it to me),
that's what we would implement. That shouldn't stop us from adding
vtkUniversalSQLDatabase later -- I don't think any API changes would be
required to add that class. Is that correct?
David
More information about the vtk-developers
mailing list