Troubleshooting QDataWidgetMapper.submit failure

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Troubleshooting QDataWidgetMapper.submit failure

Bugzilla from me@alandmoore.com
I have a form that is connected to a QSqlRelationalTableModel using
QDataWidgetMapper.  When I call the mapper's submit() method to save the
data, it returns false.  Calling lastError() on the model returns a 'no
error' code, so I'm at a loss as to why my form fails to save data.

Is there somewhere else I can look for a possible error?

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting QDataWidgetMapper.submit failure

Barry Scott


> On 11 Feb 2019, at 22:40, alan moore <[hidden email]> wrote:
>
> I have a form that is connected to a QSqlRelationalTableModel using QDataWidgetMapper.  When I call the mapper's submit() method to save the data, it returns false.  Calling lastError() on the model returns a 'no error' code, so I'm at a loss as to why my form fails to save data.
>
> Is there somewhere else I can look for a possible error?

Can you use the logs on the sql server?
At least to postgesql i have had it log the queries it receives and errorsin the past.

Barry

>
> _______________________________________________
> PyQt mailing list    [hidden email]
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting QDataWidgetMapper.submit failure

Bugzilla from me@alandmoore.com
On 2/12/19 2:29 AM, Barry wrote:
> Can you use the logs on the sql server?
> At least to postgesql i have had it log the queries it receives and errorsin the past.
>
> Barry
>
I was using SQLite in this case.  It turns out the error wasn't SQL at
all, I had a select() call happening on the model after it was shown in
the form, so the mapper's currentIndex() was reset to -1.  Once I
eliminated that, things worked fine.

Situations like this highlight my one major gripe about Qt: the way it
so often silently fails instead of throwing exceptions. Guess that's
just a C++ thing?


_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt