View Full Version : Passing additional parameters to QtSqlResult plugin

20th February 2013, 16:58

Suppose that One wants to pass additional parameters to a plugin implementation of QtSqlResult in a similar manner as the setForwardOnly parameter but for different info

Is there some generic method for adding parameters, or the base QtSqlResult class needs to be modified?

Also, that class appears to have

enum VirtualHookOperation { };
virtual void virtual_hook(int id, void *data);

What is this hook used for?


20th February 2013, 23:18
I assume you mean QSqlResult, there is no QtSqlResult.

What is this hook used for?
Qt4: Implements various 'virtual' functions in a way that maintains binary compatibly for Qt4.
Qt5: Nothing. Qt 5.x onward removes the existing uses of this hook and replaces them with real virtual functions.
See http://qt.gitorious.org/qt/qtbase/commit/fc15a1d5e2cb064df7b6e7b9e821e9db20a91b85

If you want you concrete subclass to have extra functions to configure it then by all means add them and set their values in your plugin before returning your QSqlResult*: they will not be visible through the QSqlResult interface. If the extra properties must be manipulated through the QSqlResult interface then you need to use the virtual_hook() function: see the Qt 4.8 code for example.

24th February 2013, 11:16
Yes I meant QSqlResult

Seems like the hook should be used for additional properties manipulation while maintaining binary compatability