Hi,

I've ventured into transactors and largeobjects, and some behavior's 
puzzling me. Hope it's not too much trouble to ask for an explanation, 
since I'm probably just doing something backwards...

I based my code for inserting/writing/reading largeobjects on 
test050.cxx. So far so good. However, I'd like to take the data read 
from the database (in operator()) and store it in heap-allocated memory 
for later use. To get the data out of the transactor, I thought I'd add 
a getResult() function, which returns the pointer to the data, and call 
this function after Conn.perform([my transactor]) returns.

I know the pointer is good at the end of on_commit(), but it's been 
overwritten when the caller makes the very next call, to getResult(). 
Not sure why, as my transactor instance is still in scope. Segfault follows.

I could pass a reference into the transactor constructor, and fill that 
object in, rather than allocating memory from within operator(). But I'd 
rather avoid that if possible. It seems to me that the transactor's 
fields shouldn't be compromised before it's destroyed.

Thanks for your ideas,

Curran
_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to