/* call-seq: set_authorizer = auth * * Set the authorizer for this database. +auth+ must respond to +call+, and * +call+ must take 5 arguments. * * Installs (or removes) a block that will be invoked for every access * to the database. If the block returns 0 (or +true+), the statement * is allowed to proceed. Returning 1 or false causes an authorization error to * occur, and returning 2 or nil causes the access to be silently denied. */ static VALUE set_authorizer(VALUE self, VALUE authorizer) { sqlite3RubyPtr ctx; int status; Data_Get_Struct(self, sqlite3Ruby, ctx); REQUIRE_OPEN_DB(ctx); status = sqlite3_set_authorizer( ctx->db, NIL_P(authorizer) ? NULL : rb_sqlite3_auth, (void *)self ); CHECK(ctx->db, status); rb_iv_set(self, "@authorizer", authorizer); return self; }