[vtk-developers] Re: vtkSQLDatabase

David Thompson dcthomp at sandia.gov
Wed Nov 28 12:32:06 EST 2007


On Nov 28, 2007, at 9:04 AM, Sebastien BARRE wrote:
> 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 :)
Hmm, I got the idea from vtkDataArray::CreateDataArray( int  
dataType ). :-)

	David




More information about the vtk-developers mailing list