[Qt-interest] Qt5 and SQL
Constantin Makshin
cmakshin at gmail.com
Mon Jun 6 21:48:07 CEST 2011
IMHO, this isn't so obvious. For example, exec(), primaryIndex(), record(), transaction(), commit(), rollback() and tables() methods will look [a bit] weird in a class named QSqlConnection:
1) queries are executed on the database and not on connection;
2) index is part of the database, not connection;
3) database, not connection, has records;
4) transactions make little sense in the context of connections (who *really* cares about guaranteed network packet delivery if the underlying DBMS doesn't guarantee its consistency?);
5) connection doesn't have any tables, the database does.
Also, the "connection" word itself doesn't fit the concept of embedded DBMSes like SQLite very well.
I'm not sure "QSqlConnection" name will be [significantly] less confusing than "QSqlDatabase" — the class has both connection- and database-related functions/methods. And splitting it into 2 separate classes ("QSqlConnection" with only connection-related methods like connectOptions(), hostName() and others; "QSqlDatabase" with only database-related functions like ones mentioned above) can make things look even worse.
On Monday 06 June 2011 20:26:33 Jason H wrote:
> Well, it is and isn't a database.
>
> You still have to call QSqlDatabase::addDatabase(...) which initializes the driver for a database.
> But I agree, everything else should be using a QSqlConnection class.
>
>
>
>
> ________________________________
> From: Alan Ezust <alan.ezust at gmail.com>
> To: Ed Smith-Rowland <3dw4rd at verizon.net>
> Cc: qt-interest at qt.nokia.com
> Sent: Monday, June 6, 2011 11:47 AM
> Subject: Re: [Qt-interest] Qt5 and SQL
>
> I see the QtSql module as a nice start for a database independent way
> of accessing databases.
> But the first thing I stumbled on when I was learning it and also when
> teaching it to others is the confusing name given to this class:
> "QSqlDatabase".
>
> it does not represent a database. It is a connection.
>
> 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?
>
> And also, I was wondering if anyone has any experience playing around with
> this other hibernatish object-relational mapping layer?
> http://www.codesynthesis.com/products/odb/
> >From what I can see, it doesn't use Qt to access the database, and it
> works on MySQL and SQLite.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110606/dbbb7288/attachment.bin
More information about the Qt-interest-old
mailing list