[Qt-interest] Qt5 and SQL

Ross Bencina rossb-lists at audiomulch.com
Tue Jun 7 08:34:02 CEST 2011


Andre Somers wrote:

>Op 6-6-2011 17:47, Alan Ezust schreef:
>> Shouldn't someone start the process of renaming it to QSqlConnection,
>> having a deprecated typedef to QSqlDatabase in Qt5, so that we can
>> remove QSqlDatabase from Qt6?

>To be honest, you are the first I have heard up this confusion.

Be careful with this attitude, when I take that position I usually regret it 
later. It's a kind of pointless defense against users telling you something 
is wrong with the system. Why not fix all problems rather than just those 
that lots of people are confused by? Especially high-value low effort things 
like renamings.


> I don't think this is an important one. If one were to
> re-design the complete API for it, then sure, refactor QSqlDatabase into
> something that makes more technical sense, but just a rename for the
> sake of renaming seems none-produtive to me.

Personally, I think it's extremely important. If naming is not done properly 
it reflects just as badly on the codebase as other types of flaws. It 
implies a serious deficit in design to missname something as fundamental as 
"a connection to a database" as "the database itself". If you can't even 
name objects correctly there is not much hope for the rest of the system.

On the whole Qt does a great job with naming, I think this is just a legacy 
from cloning Borland VCL (which calls the same class TDatabase).

I don't use QSql, but from memory this role is called a Connection in ADO:

http://en.wikipedia.org/wiki/ActiveX_Data_Objects

MySql php calls the object a "link" but the text still describes 
establishing a connection:
http://www.php.net/manual/en/function.mysql-connect.php

Sorry.. no time to collect more data points.


> There are bigger fish to fry.

Ever heard of broken window theory? 
http://en.wikipedia.org/wiki/Broken_windows_theory

Renaming a class is as easy as ctrl-alt-R, grep and updating the changelog. 
Easier in-fact than me writing this email.

If you don't commit to continuous improvement of the codebase it will 
ossify. A major release is a good time for this kind of change. In-fact, the 
only time given current Qt policies.

While we're at it, shouldn't QSqlDatabase::transaction() be named 
beginTransaction() ?

These things matter. I'd say fix it.

Ross.




More information about the Qt-interest-old mailing list