Class: Bdb::Txn
Instance Method Summary collapse
-
#abort ⇒ Object
txn.abort -> true.
-
#commit(vflags) ⇒ Object
txn.commit(flags) -> true.
-
#discard ⇒ Object
txn.discard -> true.
-
#set_timeout(vtimeout, vflags) ⇒ Object
tx.set_timeout(timeout,flags) -> true.
-
#tid ⇒ Object
txn.tid -> Fixnum.
Instance Method Details
#abort ⇒ Object
txn.abort -> true
abort a transaction
3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 |
# File 'ext/bdb.c', line 3212
VALUE txn_abort(VALUE obj)
{
t_txnh *txn=NULL;
int rv;
Data_Get_Struct(obj,t_txnh,txn);
if (!txn->txn)
return Qfalse;
rv=txn->txn->abort(txn->txn);
txn_finish(txn);
if ( rv != 0 ) {
raise_error(rv, "txn_abort: %s",db_strerror(rv));
return Qnil;
}
return Qtrue;
}
|
#commit(vflags) ⇒ Object
txn.commit(flags) -> true
commit a transaction
3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 |
# File 'ext/bdb.c', line 3183
VALUE txn_commit(VALUE obj, VALUE vflags)
{
t_txnh *txn=NULL;
u_int32_t flags=0;
int rv;
if ( ! NIL_P(vflags))
flags=NUM2UINT(vflags);
Data_Get_Struct(obj,t_txnh,txn);
if (!txn->txn)
return Qfalse;
rv=txn->txn->commit(txn->txn,flags);
txn_finish(txn);
if ( rv != 0 ) {
raise_error(rv, "txn_commit: %s",db_strerror(rv));
return Qnil;
}
return Qtrue;
}
|
#discard ⇒ Object
txn.discard -> true
discard a transaction. Since prepare is not yet supported, I don’t think this has much value.
3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 |
# File 'ext/bdb.c', line 3238
VALUE txn_discard(VALUE obj)
{
t_txnh *txn=NULL;
int rv;
Data_Get_Struct(obj,t_txnh,txn);
if (!txn->txn)
raise_error(0,"txn is closed");
rv=txn->txn->discard(txn->txn,NOFLAGS);
txn_finish(txn);
if ( rv != 0 ) {
raise_error(rv, "txn_abort: %s",db_strerror(rv));
return Qnil;
}
return Qtrue;
}
|
#set_timeout(vtimeout, vflags) ⇒ Object
tx.set_timeout(timeout,flags) -> true
set transaction lock timeout
3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 |
# File 'ext/bdb.c', line 3283
VALUE txn_set_timeout(VALUE obj, VALUE vtimeout, VALUE vflags)
{
t_txnh *txn=NULL;
db_timeout_t timeout;
u_int32_t flags=0;
int rv;
if ( ! NIL_P(vflags))
flags=NUM2UINT(vflags);
if ( ! FIXNUM_P(vtimeout) )
raise_error(0,"timeout must be a fixed integer");
timeout=FIX2UINT(vtimeout);
Data_Get_Struct(obj,t_txnh,txn);
if (!txn->txn)
raise_error(0,"txn is closed");
rv=txn->txn->set_timeout(txn->txn,timeout,flags);
if ( rv != 0 ) {
raise_error(rv, "txn_set_timeout: %s",db_strerror(rv));
return Qnil;
}
return Qtrue;
}
|
#tid ⇒ Object
txn.tid -> Fixnum
return the transaction id, (named tid to not conflict with ruby’s id method)
3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 |
# File 'ext/bdb.c', line 3264
VALUE txn_id(VALUE obj)
{
t_txnh *txn=NULL;
int rv;
Data_Get_Struct(obj,t_txnh,txn);
if (!txn->txn)
raise_error(0,"txn is closed");
rv=txn->txn->id(txn->txn);
return INT2FIX(rv);
}
|