fetch_by_id returns error(QSqlerror::type=4) when no data

Forum for posting problems using QxOrm library

fetch_by_id returns error(QSqlerror::type=4) when no data

Postby ledunkang » Sun Apr 13, 2014 10:11 pm

My code likes this
Code: Select all
daoError = qx::dao::fetch_by_id(ap);
        bCommit = !daoError.isValid();

        if(!bCommit)
            qDebug() << "==> DaoErr Type: " << daoError.type();

If data exists, the (oci) query executes succesfully, while it returns error if no data exists and assert failed.
I don't think that sucess query without data queried shoud be regard as an sql error. Or I missed anything?
ledunkang
 
Posts: 5
Joined: Sun Mar 30, 2014 4:36 pm

Re: fetch_by_id returns error(QSqlerror::type=4) when no dat

Postby qxorm » Mon Apr 14, 2014 7:04 am

Hi,

You are trying to fetch an item by id, so you know the id and you expect that the id exists in your database.
If not exists, there is something wrong, this is why QSqlError returns an error.

If you want to test it before fetching, just use qx::dao::exist() function.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: fetch_by_id returns error(QSqlerror::type=4) when no dat

Postby ledunkang » Mon Apr 14, 2014 2:07 pm

Thanks, I'll try.
ledunkang
 
Posts: 5
Joined: Sun Mar 30, 2014 4:36 pm


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron