[vtk-developers] Re: vtkSQLDatabase

Sebastien BARRE sebastien.barre at kitware.com
Wed Nov 28 12:04:30 EST 2007


At 11/28/2007 11:58 AM, Shead, Timothy wrote:

> > -----Original Message-----
> > Also why wouldn't SetURL/GetURL be public. Am I missing something?
> > Wouldn't you want to reconnect or connect to a different
> > database? Or do you guys enforce a new database object each time?
>
>vtkSQLDatabase is an abstract interface.  There are concrete derivatives
>for specific database implementations, such as vtkSQLiteDatabase,
>vtkMySQLDatabase, etc.  The problem is that SetURL() encourages the user
>to do things that can't work:
>
>// 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 :)
Moving on.




More information about the vtk-developers mailing list