[odb-users] Assign raw foreign key id without using a loaded object

Rene Jensen rene at catatonic.dk
Tue Sep 25 03:06:11 EDT 2012


Hi Boris.

This is a scenario which comes up very often when I use a mix of SQL
queries for some parts of the UI and ODB for others. I may have missed the
answer in the docs and source code.

Say I have an object with a QLazyWeakPointer to some other class.
Can I assign a reference to a different id without having to load the
referred object into memory first, by simply using e.g. an integer key (if
my foreign key database type was INTEGER, of course):

QSharedPointer<Format> F = ... load_format(10) ... bla bla

P->format = 10;
P->format = F;

Best regards,
Rene Jensen


More information about the odb-users mailing list