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.



412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'ext/sqlite3/database.c', line 412

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;
}