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
3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 |
# File 'ext/bdb.c', line 3166
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
3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 |
# File 'ext/bdb.c', line 3137
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.
3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 |
# File 'ext/bdb.c', line 3192
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
3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 |
# File 'ext/bdb.c', line 3237
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)
3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 |
# File 'ext/bdb.c', line 3218
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);
}
|