GnuCash Daily Source Diff

Linas Vepstas linas@linas.org
Thu, 4 Oct 2001 09:39:50 -0500


On Thu, Oct 04, 2001 at 08:05:21AM -0500, Dave Peticolas was heard to remark:
> -  account = xaccMallocAccount ();
> +  account = xaccMallocAccount (session);

I'm trying to guess why you'd need a session in 'create' ... but can't.

A lone, disconnected transaction (or account) is kind of 'meaningless'; 
it only comes to life when its manipulated  between a BeginEdit..Commit 
pair.  At that point, you would know what the session is ...

I am somewhat concerned that assigning a transaction to some session 
for the entirety of its life will prevent the ablity to copy
transactions from one session to another.   This is how I get data into
the sql db: open a file, read, (close the file, close the session),
open the sql session, write.  

The alternative would be to 'clone' all accounts/transactions into a 
new session, but this would be quite inefficieint.  And seemingly
pointless, since at the momemnt, with global sessions, you can't have
more than one 'current' session at a time.

Or is it that you are trying to have two current sessions at the same
time?   It always seemed that having one current session at a time was
enough. And if it wasn't, you could always get/set the current session 
to use teh one that you want (since your single-threaded anyway).
And if you eeded multiple threads, you'd use pthread_get_specific(),
so you could have an independent session per thread.

So, as I say, I can't guess why you need a session in the malloc ...


--linas


-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
     Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933