From: Alex P. <pes...@ma...> - 2011-03-30 10:53:31
|
On 03/28/11 19:04, Adriano dos Santos Fernandes wrote: > > --------------------- > Revision: 52587 > http://firebird.svn.sourceforge.net/firebird/?rev=52587&view=rev > Author: asfernandes > Date: 2011-03-21 21:56:47 +0000 (Mon, 21 Mar 2011) > > Log Message: > ----------- > Move transactRequest, createBlob, openBlob, getSlice, putSlice and ddl > from ITransaction to IAttachment. > > It's better to have one standard than two, and "ddl" was broken from API > POV. > So make the IAttachment always the caller, explicit or implicit (via > IStatement or IRequest), and pass the ITransaction as parameter. > --------------------- > > What you were doing was to make possible to call > transaction->createBlob(..., attachment = NULL) for single transactions, > but sure this is impossible to work with multidb transactions. Definitely yes. I've blindly kept ISC API functionality, I was wrong. But I do not see big need in moving this calls from ITransaction to IAttachment. What did you achieve with it? > So you needed the IAttachment for them, and it would be need to be > casted as we were talking. No, there is no need in casts. Instead I suggest to keep openBlob in ITransaction. SingleDB implementation stores a pointer to an YAttachment in which it was started. Let it be: YAttachment* myAttachment; Therefore: YTransaction::openBlob(BLOB_ID_TYPE blobId, IAttachment* att) { if (myAttachment == att) { next->openBlob(bolbId, myAttachment->next); return; } // raise error } Multi DB transaction stores pairs (IAttachment*, ITransaction*). Lete it be: Array<Pair<IAttachment*, ITransaction*> > pairs; And: MultiTransaction::openBlob(BLOB_ID_TYPE blobId, IAttachment* att) { for (i=0; I<pairs.count(); ++i) { if (pairs[i].left == att) { pairs[i].right->openBlob(bolbId, att); return; } } // raise error } That's all - and no casts. |