[Qt-qml] QtJsonDb QML API review

Adriano Rezende adriano.rezende at openbossa.org
Wed Nov 23 16:21:09 CET 2011


On Wed, Nov 23, 2011 at 11:34 AM,  <jamey.hicks at nokia.com> wrote:
>
> On Nov 23, 2011, at 8:14 AM, ext Adriano Rezende wrote:
>> Why JsonDb instead of providing a SQL API? Any benefits?
>> I think most developers are used to the SQL syntax and they would
>> prefer to use it.
>>
>
> This is an alternative to QSql and not designed to be a replacement for it.
>
> We also designed QtJsonDb with replication in mind, so that developers could use generic device-to-device or device-to-cloud replication protocols, though that is only in the prototyping phase.

Yes, that is a different scenario. I thought it would be the official
way to handle database operations from the QML side.

I don't know anything about the JsonDb specifications so I cannot give
a good feedback, but regarding the API, I think some names could be
changed for clarity; most of the components starts with JsonDb, except
Notification and Partition. Wouldn't be better to change their names
to JsonDbNotification and JsonDbPartition? Or just remove JsonDb
prefix and resolve nameclash through namespace. So:

- Option 1:

import QtJsonDb 1.0

JsonDbComponent {}
JsonDbPartition {}

- Option 2:

import QtJsonDb 1.0 as JsonDb

JsonDb.Component { }
JsonDb.Partition {}


It seems strange to have query attribute inside the query property.
Could partition be a separate property or other arguments are expected
in the query?

query: { "partition":"com.nokia.shared", "query":"[?_type=\"Contact\"]"}

Br,
Adriano


More information about the Qt-qml mailing list