apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: [PATCH]: Introduce APR DBD transaction mode
Date Mon, 01 May 2006 22:19:09 GMT
On Monday 01 May 2006 02:28, Bojan Smojver wrote:
> Here is the patch along the lines of setting the modes of the
> transaction. It doesn't have "force commit", but if the list decides
> that it's the right thing to do, I'll rework. I didn't test this -
> it's just a prototype. A patch for folks using MySQL is included as
> well.

OK, here's a sketch for the shape of an update based on this thread
but without reference to TFM.  Any advances on this for the underlying
model?  Or simplifications?

(1) in apr_dbd.h

#define APR_DBD_TRANSACTION_COMMIT      0x01 /* force */
#define APR_DBD_TRANSACTION_ROLLBACK   0x02 /* force */
#define APR_DBD_TRANSACTION_DEFAULT    0x03 /* commit-unless-error */
#define APR_DBD_TRANSACTION_MODEBITS  0x03
#define APR_DBD_TRANSACTION_CLEARERR  0x04

(2) in a driver

static int dbd_foo_transaction_mode(apr_dbd_transaction_t *trans,
								int flags)
{
  int ret = 0
   int mode = flags & APR_DBD_TRANSACTION_MODEBITS;
   switch (flags) {
   case APR_DBD_TRANSACTION_COMMIT:
   case APR_DBD_TRANSACTION_ROLLBACK:
      trans->mode = mode;
      break;
   default:
      trans->mode = APR_DBD_TRANSACTION_DEFAULT ;
      break;
   }
   if ((trans->errnum != 0) && (flags & APR_DBD_TRANSACTION_CLEARERR)) {
      ret = foo_clearerror(...);
      if (ret == foo_success) {
          trans->errnum = 0;
      }
   }
   return ret; /* or juggle if foo_success != 0 */
}

-- 
Nick Kew

Mime
View raw message