ext/extralite/extralite.h in extralite-2.3 vs ext/extralite/extralite.h in extralite-2.4

- old
+ new

@@ -21,29 +21,31 @@ #define SAFE(f) (VALUE (*)(VALUE))(f) extern VALUE cDatabase; extern VALUE cQuery; extern VALUE cIterator; +extern VALUE cBlob; extern VALUE cError; extern VALUE cSQLError; extern VALUE cBusyError; extern VALUE cInterruptError; +extern VALUE cParameterError; extern ID ID_call; extern ID ID_keys; extern ID ID_new; extern ID ID_strip; -extern ID ID_to_s; extern VALUE SYM_hash; extern VALUE SYM_ary; extern VALUE SYM_single_column; typedef struct { sqlite3 *sqlite3_db; VALUE trace_block; + int gvl_release_threshold; } Database_t; typedef struct { VALUE db; VALUE sql; @@ -77,23 +79,26 @@ sqlite3_stmt *stmt; VALUE params; enum query_mode mode; int max_rows; int eof; + int gvl_release_threshold; + int step_count; } query_ctx; -typedef struct { - VALUE dst; - VALUE src; - sqlite3_backup *p; -} backup_t; +enum gvl_mode { + GVL_RELEASE, + GVL_HOLD +}; -#define TUPLE_MAX_EMBEDDED_VALUES 20 #define ALL_ROWS -1 #define SINGLE_ROW -2 #define QUERY_MODE(default) (rb_block_given_p() ? QUERY_YIELD : default) #define MULTI_ROW_P(mode) (mode == QUERY_MULTI_ROW) +#define QUERY_CTX(self, db, stmt, params, mode, max_rows) \ + { self, db->sqlite3_db, stmt, params, mode, max_rows, 0, db->gvl_release_threshold, 0 } +#define DEFAULT_GVL_RELEASE_THRESHOLD 1000 extern rb_encoding *UTF8_ENCODING; VALUE safe_execute_multi(query_ctx *ctx); VALUE safe_query_ary(query_ctx *ctx); @@ -124,6 +129,8 @@ VALUE cleanup_stmt(query_ctx *ctx); sqlite3 *Database_sqlite3_db(VALUE self); Database_t *self_to_database(VALUE self); -#endif /* EXTRALITE_H */ \ No newline at end of file +void *gvl_call(enum gvl_mode mode, void *(*fn)(void *), void *data); + +#endif /* EXTRALITE_H */