You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

mrdebug

Trainee

  • "mrdebug" is male
  • "mrdebug" started this thread

Posts: 90

Occupation: Developer

  • Send private message

1

Wednesday, September 8th 2010, 8:34pm

Qt programming and Exception trouble.

I'm a beginner with Qt. I don't understand why the Exceptions are non used in Qt like in Delphi.
In a tipical function (like insert or update something in a database), in order to verify that all query have been executed correctly I must verify every single query like this:

PHP Source code

1
2
3
4
5
        if (!query.exec("select max(id_device) as id_max from Devices")) {
            Errorquery.lastError().text();
            return false;
        } else {
        ...


In this case I have insert an error that does not has generated any visible error. In Delphi on in Freepascal this error (id_AAAAAAAAAdevice does not exist) produce an Exception.

PHP Source code

1
2
3
4
5
6
7
8
9
10
                        }
                        query.prepare("insert into Devices (id_device, Socket, Description, Address, UserID, Password, Authentication, DeviceType, InputsNumber) values " \
                                   "(:id_device, :Socket, :Description, :Address, :UserID, :Password, :Authentication, :DeviceType, :InputsNumber);");
                    } else {
                        query.prepare("update Devices set Socket= :Socket, Description= :Description, Address= :Address, UserID= :UserID, Password= :Password, " \
                                   "Authentication= :Authentication, DeviceType= :DeviceType, InputsNumber= :InputsNumber where id_device= :id_device;");
                    }
                    query.bindValue(":id_AAAAAAAAAdevice"QVDevices[count].id_device); <------------------------
                    query.bindValue(":Socket"QVDevices[count].id_device);
                    ...


Which is your mode to verify that all has works correctly?