[RDP] Shooting myself in the foot with RDSqlQuery again

Dan Mills dmills at exponent.myzen.co.uk
Fri Oct 26 17:57:29 EDT 2007


On Fri, 2007-10-26 at 13:02 -0400, Fred Gleason wrote:
> Howdy Folks:

> *** snip snip ***
> QString err="myapp: ";
> QSqlDatabase *my_db=RDInitDb(&err);
> *** snip snip ***
> 
> then, at some later point, we do:
> 
> *** snip snip ***
> QString sql=<some-bad-sql>;
> RDSqlQuery *q=new RDSqlQuery(sql,my_db);
> delete q;
> [...]
> sql=<some-good-sql>;
> q=new RDSqlQuery(sql,my_db);  // WHAM-O -- Segfaults here!!
> delete q;
> *** snip snip ***

Ouch!

>  Dan, 
> is there anything in your plans that would require that this parameter be 
> retained?  

Not really other then that some of the replication scripts need it, but
they could be moved back to straight QSqlQuery instead with probably no
real effects on the reliability of anything that matters. 
Actually, these are probably wrong at the moment as they rely on having
TWO databases open and RdSqlQuery really doesn't handle that well, so
they should go back to QSqlQuery anyway!

> If we do need to retain it, then we need some sort of callback 
> mechanism for notifying clients when the handle changes.

Adding a signal to the RddbStatus singleton would not be hard, but lets
just pull the second argument and fixup what needs it for now.

Regards, Dan.





More information about the Rivendell-prog mailing list