apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject Re: [PATCH]: Introduce APR DBD transaction mode
Date Mon, 01 May 2006 23:53:35 GMT
Quoting Nick Kew <nick@webthing.com>:

> 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) {
              ^^^^^
                |-------> should be mode?

>    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(...);

I'm guessing foo_clearerror() is a database specific function for  
clearing errors, if such a beast exists. If not, user gets back  
APR_ENOTIMPL status and the whole transaction must be rolled back.  
This would obviously need to be called every time an error code is  
returned by query/select, right?

Still a little bit unclear on the function of  
APR_DBD_TRANSACTION_DEFAULT here. Given that the errors need to be  
cleared explicitly anyway (or at least that's how I read it), having  
one commit mode should be sufficient (i.e. if the errors weren't  
cleared by using APR_DBD_TRANSACTION_CLEARERR, commit won't work  
anyway).

-- 
Bojan

Mime
View raw message