Method: SQLite3::Database#define_function_with_flags
- Defined in:
- ext/sqlite3/database.c
#define_function_with_flags(name, flags) {|args, ...| ... } ⇒ Object
Define a function named name with args using TextRep bitflags flags. The arity of the block will be used as the arity for the function defined.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'ext/sqlite3/database.c', line 314
static VALUE define_function_with_flags(VALUE self, VALUE name, VALUE flags)
{
sqlite3RubyPtr ctx;
VALUE block;
int status;
Data_Get_Struct(self, sqlite3Ruby, ctx);
REQUIRE_OPEN_DB(ctx);
block = rb_block_proc();
status = sqlite3_create_function(
ctx->db,
StringValuePtr(name),
rb_proc_arity(block),
NUM2INT(flags),
(void *)block,
rb_sqlite3_func,
NULL,
NULL
);
CHECK(ctx->db, status);
rb_hash_aset(rb_iv_get(self, "@functions"), name, block);
return self;
}
|