Method: SQLite3::Database#statement_timeout=
- Defined in:
- ext/sqlite3/database.c
#statement_timeout=(ms) ⇒ Object
Indicates that if a query lasts longer than the indicated number of milliseconds, SQLite should interrupt that query and return an error. By default, SQLite does not interrupt queries. To restore the default behavior, send 0 as the ms
parameter.
363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'ext/sqlite3/database.c', line 363
static VALUE
set_statement_timeout(VALUE self, VALUE milliseconds)
{
sqlite3RubyPtr ctx;
TypedData_Get_Struct(self, sqlite3Ruby, &database_type, ctx);
ctx->stmt_timeout = NUM2INT(milliseconds);
int n = NUM2INT(milliseconds) == 0 ? -1 : 1000;
sqlite3_progress_handler(ctx->db, n, rb_sqlite3_statement_timeout, (void *)ctx);
return self;
}
|