-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-# define LLONG_MAX __LONG_LONG_MAX__
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
-#endif
-
-
- #define SWIG_From_long LONG2NUM
-
-
-SWIGINTERNINLINE VALUE
-SWIG_From_int (int value)
-{
- return SWIG_From_long (value);
-}
-
-
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
-{
- static int init = 0;
- static swig_type_info* info = 0;
- if (!init) {
- info = SWIG_TypeQuery("_p_char");
- init = 1;
- }
- return info;
-}
-
-
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
-{
- if (TYPE(obj) == T_STRING) {
- #if defined(StringValuePtr)
- char *cstr = StringValuePtr(obj);
- #else
- char *cstr = STR2CSTR(obj);
- #endif
- size_t size = RSTRING_LEN(obj) + 1;
- if (cptr) {
- if (alloc) {
- if (*alloc == SWIG_NEWOBJ) {
- *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
- } else {
- *cptr = cstr;
- *alloc = SWIG_OLDOBJ;
- }
- }
- }
- if (psize) *psize = size;
- return SWIG_OK;
- } else {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- if (pchar_descriptor) {
- void* vptr = 0;
- if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
- if (cptr) *cptr = (char *)vptr;
- if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
- if (alloc) *alloc = SWIG_OLDOBJ;
- return SWIG_OK;
- }
- }
- }
- return SWIG_TypeError;
-}
-
-
-
-
-
-SWIGINTERN VALUE
-SWIG_ruby_failed(void)
-{
- return Qnil;
-}
-
-
-/*@SWIG:C:\\Users\\Luis\\Downloads\\swigwin-1.3.39\\Lib\\ruby\\rubyprimtypes.swg,23,%ruby_aux_method@*/
-SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
-{
- VALUE obj = args[0];
- VALUE type = TYPE(obj);
- long *res = (long *)(args[1]);
- *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
- return obj;
-}
-/*@SWIG@*/
-
-SWIGINTERN int
-SWIG_AsVal_long (VALUE obj, long* val)
-{
- VALUE type = TYPE(obj);
- if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
- long v;
- VALUE a[2];
- a[0] = obj;
- a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
- if (val) *val = v;
- return SWIG_OK;
- }
- }
- return SWIG_TypeError;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_int (VALUE obj, int *val)
-{
- long v;
- int res = SWIG_AsVal_long (obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v < INT_MIN || v > INT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = (int)(v);
- }
- }
- return res;
-}
-
-
-/*@SWIG:C:\\Users\\Luis\\Downloads\\swigwin-1.3.39\\Lib\\ruby\\rubyprimtypes.swg,23,%ruby_aux_method@*/
-SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
-{
- VALUE obj = args[0];
- VALUE type = TYPE(obj);
- double *res = (double *)(args[1]);
- *res = (type == T_FLOAT ? NUM2DBL(obj) : (type == T_FIXNUM ? (double) FIX2INT(obj) : rb_big2dbl(obj)));
- return obj;
-}
-/*@SWIG@*/
-
-SWIGINTERN int
-SWIG_AsVal_double (VALUE obj, double *val)
-{
- VALUE type = TYPE(obj);
- if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
- double v;
- VALUE a[2];
- a[0] = obj;
- a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
- if (val) *val = v;
- return SWIG_OK;
- }
- }
- return SWIG_TypeError;
-}
-
-
- #define SWIG_From_double rb_float_new
-
-swig_class SwigClassCallbackData;
-
-SWIGINTERN VALUE
-_wrap_CallbackData_proc_set(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *arg1 = (struct CallbackData *) 0 ;
- VALUE arg2 = (VALUE) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CallbackData, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CallbackData *","proc", 1, self ));
- }
- arg1 = (struct CallbackData *)(argp1);
- arg2 = argv[0];
- if (arg1) (arg1)->proc = arg2;
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CallbackData_proc_get(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *arg1 = (struct CallbackData *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- VALUE result;
- VALUE vresult = Qnil;
-
- if ((argc < 0) || (argc > 0)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CallbackData, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CallbackData *","proc", 1, self ));
- }
- arg1 = (struct CallbackData *)(argp1);
- result = (VALUE) ((arg1)->proc);
- vresult = result;
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CallbackData_proc2_set(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *arg1 = (struct CallbackData *) 0 ;
- VALUE arg2 = (VALUE) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CallbackData, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CallbackData *","proc2", 1, self ));
- }
- arg1 = (struct CallbackData *)(argp1);
- arg2 = argv[0];
- if (arg1) (arg1)->proc2 = arg2;
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CallbackData_proc2_get(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *arg1 = (struct CallbackData *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- VALUE result;
- VALUE vresult = Qnil;
-
- if ((argc < 0) || (argc > 0)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CallbackData, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CallbackData *","proc2", 1, self ));
- }
- arg1 = (struct CallbackData *)(argp1);
- result = (VALUE) ((arg1)->proc2);
- vresult = result;
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CallbackData_data_set(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *arg1 = (struct CallbackData *) 0 ;
- VALUE arg2 = (VALUE) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CallbackData, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CallbackData *","data", 1, self ));
- }
- arg1 = (struct CallbackData *)(argp1);
- arg2 = argv[0];
- if (arg1) (arg1)->data = arg2;
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_CallbackData_data_get(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *arg1 = (struct CallbackData *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- VALUE result;
- VALUE vresult = Qnil;
-
- if ((argc < 0) || (argc > 0)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CallbackData, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CallbackData *","data", 1, self ));
- }
- arg1 = (struct CallbackData *)(argp1);
- result = (VALUE) ((arg1)->data);
- vresult = result;
- return vresult;
-fail:
- return Qnil;
-}
-
-
-#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
-SWIGINTERN VALUE
-_wrap_CallbackData_allocate(VALUE self) {
-#else
- SWIGINTERN VALUE
- _wrap_CallbackData_allocate(int argc, VALUE *argv, VALUE self) {
-#endif
-
-
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CallbackData);
-#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
- rb_obj_call_init(vresult, argc, argv);
-#endif
- return vresult;
- }
-
-
-SWIGINTERN VALUE
-_wrap_new_CallbackData(int argc, VALUE *argv, VALUE self) {
- struct CallbackData *result = 0 ;
-
- if ((argc < 0) || (argc > 0)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
- }
- result = (struct CallbackData *)calloc(1, sizeof(struct CallbackData));
- DATA_PTR(self) = result;
- return self;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN void
-free_CallbackData(struct CallbackData *arg1) {
- free((char *) arg1);
-}
-
-SWIGINTERN VALUE
-_wrap_sqlite3_libversion(int argc, VALUE *argv, VALUE self) {
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 0) || (argc > 0)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
- }
- result = (char *)sqlite3_libversion();
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_close(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_close", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = (int)sqlite3_close(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_last_insert_rowid(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- sqlite_int64 result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_last_insert_rowid", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = sqlite3_last_insert_rowid(arg1);
- {
- vresult = rb_ll2inum( result );
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_changes(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_changes", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = (int)sqlite3_changes(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_total_changes(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_total_changes", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = (int)sqlite3_total_changes(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_interrupt(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_interrupt", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- sqlite3_interrupt(arg1);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_complete(int argc, VALUE *argv, VALUE self) {
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","sqlite3_complete", 1, argv[0] ));
- }
- arg1 = (char *)(buf1);
- result = (int)sqlite3_complete((char const *)arg1);
- vresult = SWIG_From_int((int)(result));
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
- return vresult;
-fail:
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_complete16(int argc, VALUE *argv, VALUE self) {
- void *arg1 = (void *) 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- {
- arg1 = (void*)RSTRING_PTR(argv[0]);
- }
- result = (int)sqlite3_complete16((void const *)arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_busy_handler(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- int (*arg2)(void *,int) = (int (*)(void *,int)) 0 ;
- void *arg3 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res3 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_busy_handler", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- {
- int res = SWIG_ConvertFunctionPtr(argv[1], (void**)(&arg2), SWIGTYPE_p_f_p_void_int__int);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "int (*)(void *,int)","sqlite3_busy_handler", 2, argv[1] ));
- }
- }
- res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","sqlite3_busy_handler", 3, argv[2] ));
- }
- result = (int)sqlite3_busy_handler(arg1,arg2,arg3);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_busy_timeout(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_busy_timeout", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_busy_timeout", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (int)sqlite3_busy_timeout(arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_set_authorizer(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- int (*arg2)(void *,int,char const *,char const *,char const *,char const *) = (int (*)(void *,int,char const *,char const *,char const *,char const *)) 0 ;
- void *arg3 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res3 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_set_authorizer", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- {
- int res = SWIG_ConvertFunctionPtr(argv[1], (void**)(&arg2), SWIGTYPE_p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "int (*)(void *,int,char const *,char const *,char const *,char const *)","sqlite3_set_authorizer", 2, argv[1] ));
- }
- }
- res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","sqlite3_set_authorizer", 3, argv[2] ));
- }
- result = (int)sqlite3_set_authorizer(arg1,arg2,arg3);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_trace(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void (*arg2)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
- void *arg3 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res3 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_trace", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- {
- int res = SWIG_ConvertFunctionPtr(argv[1], (void**)(&arg2), SWIGTYPE_p_f_p_void_p_q_const__char__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(void *,char const *)","sqlite3_trace", 2, argv[1] ));
- }
- }
- res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","sqlite3_trace", 3, argv[2] ));
- }
- result = (int)sqlite3_trace(arg1,arg2,arg3);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_open(int argc, VALUE *argv, VALUE self) {
- char *arg1 = (char *) 0 ;
- sqlite3 **arg2 = (sqlite3 **) 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- {
- arg1 = STR2CSTR(argv[0]);
- arg2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
- }
- result = (int)sqlite3_open((char const *)arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- {
- VALUE ary;
- ary = rb_ary_new2(2);
- rb_ary_push( ary, vresult );
- rb_ary_push( ary, SWIG_NewPointerObj( *arg2, SWIGTYPE_p_sqlite3, 0 ) );
- free( arg2 );
- vresult = ary;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_open16(int argc, VALUE *argv, VALUE self) {
- void *arg1 = (void *) 0 ;
- sqlite3 **arg2 = (sqlite3 **) 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- {
- arg1 = (void*)RSTRING_PTR(argv[0]);
- arg2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
- }
- result = (int)sqlite3_open16((void const *)arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- {
- VALUE ary;
- ary = rb_ary_new2(2);
- rb_ary_push( ary, vresult );
- rb_ary_push( ary, SWIG_NewPointerObj( *arg2, SWIGTYPE_p_sqlite3, 0 ) );
- free( arg2 );
- vresult = ary;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_errcode(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_errcode", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = (int)sqlite3_errcode(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_errmsg(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_errmsg", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = (char *)sqlite3_errmsg(arg1);
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_errmsg16(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_errmsg16", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- result = (void *)sqlite3_errmsg16(arg1);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_prepare(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- sqlite3_stmt **arg4 = (sqlite3_stmt **) 0 ;
- char **arg5 = (char **) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- sqlite3_stmt *stmt2 ;
- char *errmsg2 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_prepare", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- {
- arg2 = RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = &stmt2;
- arg5 = &errmsg2;
- }
- result = (int)sqlite3_prepare(arg1,(char const *)arg2,arg3,arg4,(char const **)arg5);
- vresult = SWIG_From_int((int)(result));
- {
- VALUE ary;
- ary = rb_ary_new2(3);
- rb_ary_push( ary, vresult );
- rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
- rb_ary_push( ary, errmsg2 ? rb_str_new2( errmsg2 ) : Qnil );
- vresult = ary;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_prepare16(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- sqlite3_stmt **arg4 = (sqlite3_stmt **) 0 ;
- void **arg5 = (void **) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- sqlite3_stmt *stmt2 ;
- void *errmsg2 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_prepare16", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- {
- arg2 = RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = &stmt2;
- arg5 = &errmsg2;
- }
- result = (int)sqlite3_prepare16(arg1,(void const *)arg2,arg3,arg4,(void const **)arg5);
- vresult = SWIG_From_int((int)(result));
- {
- VALUE ary;
- int i;
-
- for( i = 0; ((char*)errmsg2)[i]; i += 2 );
-
- ary = rb_ary_new2(3);
- rb_ary_push( ary, vresult );
- rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
- rb_ary_push( ary, errmsg2 ? rb_str_new( (char*)errmsg2, i ) : Qnil );
- vresult = ary;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_blob(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *arg3 = (void *) 0 ;
- int arg4 ;
- void (*arg5)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_blob", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_blob", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- {
- arg3 = (void*)RSTRING_PTR(argv[2]);
- arg4 = RSTRING_LEN(argv[2]);
- arg5 = SQLITE_TRANSIENT;
- }
- result = (int)sqlite3_bind_blob(arg1,arg2,(void const *)arg3,arg4,arg5);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_double(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- double arg3 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- double val3 ;
- int ecode3 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_double", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_double", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- ecode3 = SWIG_AsVal_double(argv[2], &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","sqlite3_bind_double", 3, argv[2] ));
- }
- arg3 = (double)(val3);
- result = (int)sqlite3_bind_double(arg1,arg2,arg3);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_int(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- int arg3 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_int", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_int", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- ecode3 = SWIG_AsVal_int(argv[2], &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","sqlite3_bind_int", 3, argv[2] ));
- }
- arg3 = (int)(val3);
- result = (int)sqlite3_bind_int(arg1,arg2,arg3);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_int64(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- sqlite_int64 arg3 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_int64", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_int64", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- {
- arg3 = rb_num2ll( argv[2] );
- }
- result = (int)sqlite3_bind_int64(arg1,arg2,arg3);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_null(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_null", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_null", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (int)sqlite3_bind_null(arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_text(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- void (*arg5)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_text", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_text", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- {
- arg3 = RSTRING_PTR(argv[2]);
- arg4 = RSTRING_LEN(argv[2]);
- arg5 = SQLITE_TRANSIENT;
- }
- result = (int)sqlite3_bind_text(arg1,arg2,(char const *)arg3,arg4,arg5);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_text16(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *arg3 = (void *) 0 ;
- int arg4 ;
- void (*arg5)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 3) || (argc > 3)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_text16", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_text16", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- {
- arg3 = (void*)RSTRING_PTR(argv[2]);
- arg4 = RSTRING_LEN(argv[2]);
- arg5 = SQLITE_TRANSIENT;
- }
- result = (int)sqlite3_bind_text16(arg1,arg2,(void const *)arg3,arg4,arg5);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_parameter_count(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_parameter_count", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- result = (int)sqlite3_bind_parameter_count(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_parameter_name(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_parameter_name", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_bind_parameter_name", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (char *)sqlite3_bind_parameter_name(arg1,arg2);
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_bind_parameter_index(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_bind_parameter_index", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","sqlite3_bind_parameter_index", 2, argv[1] ));
- }
- arg2 = (char *)(buf2);
- result = (int)sqlite3_bind_parameter_index(arg1,(char const *)arg2);
- vresult = SWIG_From_int((int)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return vresult;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_count(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_count", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- result = (int)sqlite3_column_count(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_name(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_name", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_name", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (char *)sqlite3_column_name(arg1,arg2);
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_name16(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_name16", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_name16", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (void *)sqlite3_column_name16(arg1,arg2);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_decltype(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_decltype", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_decltype", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (char *)sqlite3_column_decltype(arg1,arg2);
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_decltype16(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_decltype16", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_decltype16", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (void *)sqlite3_column_decltype16(arg1,arg2);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_step(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_step", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- result = (int)sqlite3_step(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_data_count(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_data_count", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- result = (int)sqlite3_data_count(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_blob(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- RUBY_BLOB *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_blob", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_blob", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (RUBY_BLOB *)sqlite3_column_blob(arg1,arg2);
- {
- vresult = result ?
- rb_str_new( (char*)result, sqlite3_column_bytes( arg1, arg2 ) ) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_bytes(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_bytes", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_bytes", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (int)sqlite3_column_bytes(arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_bytes16(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_bytes16", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_bytes16", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (int)sqlite3_column_bytes16(arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_double(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- double result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_double", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_double", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (double)sqlite3_column_double(arg1,arg2);
- vresult = SWIG_From_double((double)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_int(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- double result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_int", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_int", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (double)sqlite3_column_int(arg1,arg2);
- vresult = SWIG_From_double((double)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_int64(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- sqlite_int64 result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_int64", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_int64", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = sqlite3_column_int64(arg1,arg2);
- {
- vresult = rb_ll2inum( result );
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_text(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_text", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_text", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (char *)sqlite3_column_text(arg1,arg2);
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_text16(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_text16", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_text16", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (void *)sqlite3_column_text16(arg1,arg2);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_column_type(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_column_type", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_column_type", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- result = (int)sqlite3_column_type(arg1,arg2);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_finalize(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_finalize", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- result = (int)sqlite3_finalize(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_reset(int argc, VALUE *argv, VALUE self) {
- sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_stmt, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_stmt *","sqlite3_reset", 1, argv[0] ));
- }
- arg1 = (sqlite3_stmt *)(argp1);
- result = (int)sqlite3_reset(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_create_function(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- void *arg5 = (void *) 0 ;
- void (*arg6)(sqlite3_context *,int,sqlite3_value **) = (void (*)(sqlite3_context *,int,sqlite3_value **)) 0 ;
- void (*arg7)(sqlite3_context *,int,sqlite3_value **) = (void (*)(sqlite3_context *,int,sqlite3_value **)) 0 ;
- void (*arg8)(sqlite3_context *) = (void (*)(sqlite3_context *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int res5 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 8) || (argc > 8)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 8)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_create_function", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","sqlite3_create_function", 2, argv[1] ));
- }
- arg2 = (char *)(buf2);
- ecode3 = SWIG_AsVal_int(argv[2], &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","sqlite3_create_function", 3, argv[2] ));
- }
- arg3 = (int)(val3);
- ecode4 = SWIG_AsVal_int(argv[3], &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","sqlite3_create_function", 4, argv[3] ));
- }
- arg4 = (int)(val4);
- res5 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg5), 0, 0);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "void *","sqlite3_create_function", 5, argv[4] ));
- }
- {
- int res = SWIG_ConvertFunctionPtr(argv[5], (void**)(&arg6), SWIGTYPE_p_f_p_sqlite3_context_int_p_p_sqlite3_value__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(sqlite3_context *,int,sqlite3_value **)","sqlite3_create_function", 6, argv[5] ));
- }
- }
- {
- int res = SWIG_ConvertFunctionPtr(argv[6], (void**)(&arg7), SWIGTYPE_p_f_p_sqlite3_context_int_p_p_sqlite3_value__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(sqlite3_context *,int,sqlite3_value **)","sqlite3_create_function", 7, argv[6] ));
- }
- }
- {
- int res = SWIG_ConvertFunctionPtr(argv[7], (void**)(&arg8), SWIGTYPE_p_f_p_sqlite3_context__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(sqlite3_context *)","sqlite3_create_function", 8, argv[7] ));
- }
- }
- result = (int)sqlite3_create_function(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8);
- vresult = SWIG_From_int((int)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return vresult;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_create_function16(int argc, VALUE *argv, VALUE self) {
- sqlite3 *arg1 = (sqlite3 *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- int arg4 ;
- void *arg5 = (void *) 0 ;
- void (*arg6)(sqlite3_context *,int,sqlite3_value **) = (void (*)(sqlite3_context *,int,sqlite3_value **)) 0 ;
- void (*arg7)(sqlite3_context *,int,sqlite3_value **) = (void (*)(sqlite3_context *,int,sqlite3_value **)) 0 ;
- void (*arg8)(sqlite3_context *) = (void (*)(sqlite3_context *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int res5 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 8) || (argc > 8)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 8)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3 *","sqlite3_create_function16", 1, argv[0] ));
- }
- arg1 = (sqlite3 *)(argp1);
- {
- arg2 = (void*)RSTRING_PTR(argv[1]);
- }
- ecode3 = SWIG_AsVal_int(argv[2], &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","sqlite3_create_function16", 3, argv[2] ));
- }
- arg3 = (int)(val3);
- ecode4 = SWIG_AsVal_int(argv[3], &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","sqlite3_create_function16", 4, argv[3] ));
- }
- arg4 = (int)(val4);
- res5 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg5), 0, 0);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "void *","sqlite3_create_function16", 5, argv[4] ));
- }
- {
- int res = SWIG_ConvertFunctionPtr(argv[5], (void**)(&arg6), SWIGTYPE_p_f_p_sqlite3_context_int_p_p_sqlite3_value__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(sqlite3_context *,int,sqlite3_value **)","sqlite3_create_function16", 6, argv[5] ));
- }
- }
- {
- int res = SWIG_ConvertFunctionPtr(argv[6], (void**)(&arg7), SWIGTYPE_p_f_p_sqlite3_context_int_p_p_sqlite3_value__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(sqlite3_context *,int,sqlite3_value **)","sqlite3_create_function16", 7, argv[6] ));
- }
- }
- {
- int res = SWIG_ConvertFunctionPtr(argv[7], (void**)(&arg8), SWIGTYPE_p_f_p_sqlite3_context__void);
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "void (*)(sqlite3_context *)","sqlite3_create_function16", 8, argv[7] ));
- }
- }
- result = (int)sqlite3_create_function16(arg1,(void const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_aggregate_count(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_aggregate_count", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- result = (int)sqlite3_aggregate_count(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_blob(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- RUBY_VALBLOB *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_blob", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (RUBY_VALBLOB *)sqlite3_value_blob(arg1);
- {
- vresult = result ? rb_str_new( (char*)result, sqlite3_value_bytes( arg1 ) ) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_bytes(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_bytes", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (int)sqlite3_value_bytes(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_bytes16(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_bytes16", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (int)sqlite3_value_bytes16(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_double(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- double result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_double", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (double)sqlite3_value_double(arg1);
- vresult = SWIG_From_double((double)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_int(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_int", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (int)sqlite3_value_int(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_int64(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- sqlite_int64 result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_int64", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = sqlite3_value_int64(arg1);
- {
- vresult = rb_ll2inum( result );
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_text(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- char *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_text", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (char *)sqlite3_value_text(arg1);
- {
- vresult = result ? rb_str_new2(result) : Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_text16(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_text16", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (void *)sqlite3_value_text16(arg1);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_text16le(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_text16le", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (void *)sqlite3_value_text16le(arg1);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_text16be(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_text16be", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (void *)sqlite3_value_text16be(arg1);
- {
- int i;
- if( result ) {
- for( i = 0; ((char*)result)[i]; i += 2 );
- vresult = rb_str_new( (char*)result, i );
- } else vresult = Qnil;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_value_type(int argc, VALUE *argv, VALUE self) {
- sqlite3_value *arg1 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int result;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_value_type", 1, argv[0] ));
- }
- arg1 = (sqlite3_value *)(argp1);
- result = (int)sqlite3_value_type(arg1);
- vresult = SWIG_From_int((int)(result));
- return vresult;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_blob(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- void (*arg4)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_blob", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = (void*)RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = SQLITE_TRANSIENT;
- }
- sqlite3_result_blob(arg1,(void const *)arg2,arg3,arg4);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_double(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- double arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- double val2 ;
- int ecode2 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_double", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- ecode2 = SWIG_AsVal_double(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","sqlite3_result_double", 2, argv[1] ));
- }
- arg2 = (double)(val2);
- sqlite3_result_double(arg1,arg2);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_error(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_error", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- }
- sqlite3_result_error(arg1,(char const *)arg2,arg3);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_error16(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_error16", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = (void*)RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- }
- sqlite3_result_error16(arg1,(void const *)arg2,arg3);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_int(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_int", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","sqlite3_result_int", 2, argv[1] ));
- }
- arg2 = (int)(val2);
- sqlite3_result_int(arg1,arg2);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_int64(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- sqlite_int64 arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_int64", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = rb_num2ll( argv[1] );
- }
- sqlite3_result_int64(arg1,arg2);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_text(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- void (*arg4)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_text", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = SQLITE_TRANSIENT;
- }
- sqlite3_result_text(arg1,(char const *)arg2,arg3,arg4);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_text16(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- void (*arg4)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_text16", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = (void*)RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = SQLITE_TRANSIENT;
- }
- sqlite3_result_text16(arg1,(void const *)arg2,arg3,arg4);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_text16le(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- void (*arg4)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_text16le", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = (void*)RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = SQLITE_TRANSIENT;
- }
- sqlite3_result_text16le(arg1,(void const *)arg2,arg3,arg4);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_text16be(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- void *arg2 = (void *) 0 ;
- int arg3 ;
- void (*arg4)(void *) = (void (*)(void *)) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_text16be", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- {
- arg2 = (void*)RSTRING_PTR(argv[1]);
- arg3 = RSTRING_LEN(argv[1]);
- arg4 = SQLITE_TRANSIENT;
- }
- sqlite3_result_text16be(arg1,(void const *)arg2,arg3,arg4);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_result_value(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- sqlite3_value *arg2 = (sqlite3_value *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
-
- if ((argc < 2) || (argc > 2)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
- }
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_sqlite3_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "sqlite3_context *","sqlite3_result_value", 1, argv[0] ));
- }
- arg1 = (sqlite3_context *)(argp1);
- res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_sqlite3_value, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "sqlite3_value *","sqlite3_result_value", 2, argv[1] ));
- }
- arg2 = (sqlite3_value *)(argp2);
- sqlite3_result_value(arg1,arg2);
- return Qnil;
-fail:
- return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_sqlite3_aggregate_context(int argc, VALUE *argv, VALUE self) {
- sqlite3_context *arg1 = (sqlite3_context *) 0 ;
- int arg2 ;
- VALUE *result = 0 ;
- VALUE vresult = Qnil;
-
- if ((argc < 1) || (argc > 1)) {
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
- }
- {
- SWIG_ConvertPtr(argv[0],(void**)&arg1, SWIGTYPE_p_sqlite3_context, 1);
- arg2 = 4;
- }
- result = (VALUE *)sqlite3_aggregate_context(arg1,arg2);
- {
- vresult = *(VALUE*)result;
- }
- return vresult;
-fail:
- return Qnil;
-}
-
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-
-static swig_type_info _swigt__p_CallbackData = {"_p_CallbackData", "CallbackData *|struct CallbackData *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_f_p_sqlite3_context__void = {"_p_f_p_sqlite3_context__void", "void (*)(sqlite3_context *)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_f_p_sqlite3_context_int_p_p_sqlite3_value__void = {"_p_f_p_sqlite3_context_int_p_p_sqlite3_value__void", "void (*)(sqlite3_context *,int,sqlite3_value **)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_f_p_void__void = {"_p_f_p_void__void", "void (*)(void *)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_f_p_void_int__int = {"_p_f_p_void_int__int", "int (*)(void *,int)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int = {"_p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int", "int (*)(void *,int,char const *,char const *,char const *,char const *)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_f_p_void_p_q_const__char__void = {"_p_f_p_void_p_q_const__char__void", "void (*)(void *,char const *)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_p_sqlite3 = {"_p_p_sqlite3", "sqlite3 **", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_p_sqlite3_stmt = {"_p_p_sqlite3_stmt", "sqlite3_stmt **", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_sqlite3 = {"_p_sqlite3", "sqlite3 *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_sqlite3_context = {"_p_sqlite3_context", "sqlite3_context *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_sqlite3_stmt = {"_p_sqlite3_stmt", "sqlite3_stmt *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_sqlite3_value = {"_p_sqlite3_value", "sqlite3_value *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_sqlite_int64 = {"_p_sqlite_int64", "sqlite_int64 *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "RUBY_VALBLOB *|RUBY_BLOB *|void *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
- &_swigt__p_CallbackData,
- &_swigt__p_char,
- &_swigt__p_f_p_sqlite3_context__void,
- &_swigt__p_f_p_sqlite3_context_int_p_p_sqlite3_value__void,
- &_swigt__p_f_p_void__void,
- &_swigt__p_f_p_void_int__int,
- &_swigt__p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int,
- &_swigt__p_f_p_void_p_q_const__char__void,
- &_swigt__p_p_char,
- &_swigt__p_p_sqlite3,
- &_swigt__p_p_sqlite3_stmt,
- &_swigt__p_p_void,
- &_swigt__p_sqlite3,
- &_swigt__p_sqlite3_context,
- &_swigt__p_sqlite3_stmt,
- &_swigt__p_sqlite3_value,
- &_swigt__p_sqlite_int64,
- &_swigt__p_void,
-};
-
-static swig_cast_info _swigc__p_CallbackData[] = { {&_swigt__p_CallbackData, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_f_p_sqlite3_context__void[] = { {&_swigt__p_f_p_sqlite3_context__void, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_f_p_sqlite3_context_int_p_p_sqlite3_value__void[] = { {&_swigt__p_f_p_sqlite3_context_int_p_p_sqlite3_value__void, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_f_p_void__void[] = { {&_swigt__p_f_p_void__void, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_f_p_void_int__int[] = { {&_swigt__p_f_p_void_int__int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int[] = { {&_swigt__p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_f_p_void_p_q_const__char__void[] = { {&_swigt__p_f_p_void_p_q_const__char__void, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_p_sqlite3[] = { {&_swigt__p_p_sqlite3, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_p_sqlite3_stmt[] = { {&_swigt__p_p_sqlite3_stmt, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_p_void[] = { {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_sqlite3[] = { {&_swigt__p_sqlite3, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_sqlite3_context[] = { {&_swigt__p_sqlite3_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_sqlite3_stmt[] = { {&_swigt__p_sqlite3_stmt, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_sqlite3_value[] = { {&_swigt__p_sqlite3_value, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_sqlite_int64[] = { {&_swigt__p_sqlite_int64, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
- _swigc__p_CallbackData,
- _swigc__p_char,
- _swigc__p_f_p_sqlite3_context__void,
- _swigc__p_f_p_sqlite3_context_int_p_p_sqlite3_value__void,
- _swigc__p_f_p_void__void,
- _swigc__p_f_p_void_int__int,
- _swigc__p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int,
- _swigc__p_f_p_void_p_q_const__char__void,
- _swigc__p_p_char,
- _swigc__p_p_sqlite3,
- _swigc__p_p_sqlite3_stmt,
- _swigc__p_p_void,
- _swigc__p_sqlite3,
- _swigc__p_sqlite3_context,
- _swigc__p_sqlite3_stmt,
- _swigc__p_sqlite3_value,
- _swigc__p_sqlite_int64,
- _swigc__p_void,
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-
-/* -----------------------------------------------------------------------------
- * Type initialization:
- * This problem is tough by the requirement that no dynamic
- * memory is used. Also, since swig_type_info structures store pointers to
- * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization.
- * The idea is that swig generates all the structures that are needed.
- * The runtime then collects these partially filled structures.
- * The SWIG_InitializeModule function takes these initial arrays out of
- * swig_module, and does all the lookup, filling in the swig_module.types
- * array with the correct data and linking the correct swig_cast_info
- * structures together.
- *
- * The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop through that array, and handle each type individually.
- * First we lookup if this type has been already loaded, and if so, use the
- * loaded structure instead of the generated one. Then we have to fill in the
- * cast linked list. The cast data is initially stored in something like a
- * two-dimensional array. Each row corresponds to a type (there are the same
- * number of rows as there are in the swig_type_initial array). Each entry in
- * a column is one of the swig_cast_info structures for that type.
- * The cast_initial array is actually an array of arrays, because each row has
- * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it
- * adding the casts to the list. The one last trick we need to do is making
- * sure the type pointer in the swig_cast_info struct is correct.
- *
- * First off, we lookup the cast->type name to see if it is already loaded.
- * There are three cases to handle:
- * 1) If the cast->type has already been loaded AND the type we are adding
- * casting info to has not been loaded (it is in this module), THEN we
- * replace the cast->type pointer with the type pointer that has already
- * been loaded.
- * 2) If BOTH types (the one we are adding casting info to, and the
- * cast->type) are loaded, THEN the cast info has already been loaded by
- * the previous module so we just ignore it.
- * 3) Finally, if cast->type has not already been loaded, then we add that
- * swig_cast_info to the linked list (because the cast->type) pointer will
- * be correct.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* c-mode */
-#endif
-#endif
-
-#if 0
-#define SWIGRUNTIME_DEBUG
-#endif
-
-
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
- size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
-
- clientdata = clientdata;
-
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
-
- /* Try and load any already created modules */
- module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
- swig_module.next = module_head->next;
- module_head->next = &swig_module;
- }
-
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
- /* Now work on filling in swig_module.types */
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
-#endif
- for (i = 0; i < swig_module.size; ++i) {
- swig_type_info *type = 0;
- swig_type_info *ret;
- swig_cast_info *cast;
-
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-#endif
-
- /* if there is another module already loaded */
- if (swig_module.next != &swig_module) {
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
- }
- if (type) {
- /* Overwrite clientdata field */
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found type %s\n", type->name);
-#endif
- if (swig_module.type_initial[i]->clientdata) {
- type->clientdata = swig_module.type_initial[i]->clientdata;
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
-#endif
- }
- } else {
- type = swig_module.type_initial[i];
- }
-
- /* Insert casting types */
- cast = swig_module.cast_initial[i];
- while (cast->type) {
-
- /* Don't need to add information already in the list */
- ret = 0;
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
-#endif
- if (swig_module.next != &swig_module) {
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
-#ifdef SWIGRUNTIME_DEBUG
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
-#endif
- }
- if (ret) {
- if (type == swig_module.type_initial[i]) {
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
-#endif
- cast->type = ret;
- ret = 0;
- } else {
- /* Check for casting already in the list */
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
-#ifdef SWIGRUNTIME_DEBUG
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
-#endif
- if (!ocast) ret = 0;
- }
- }
-
- if (!ret) {
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
-#endif
- if (type->cast) {
- type->cast->prev = cast;
- cast->next = type->cast;
- }
- type->cast = cast;
- }
- cast++;
- }
- /* Set entry in modules->types array equal to the type */
- swig_module.types[i] = type;
- }
- swig_module.types[i] = 0;
-
-#ifdef SWIGRUNTIME_DEBUG
- printf("**** SWIG_InitializeModule: Cast List ******\n");
- for (i = 0; i < swig_module.size; ++i) {
- int j = 0;
- swig_cast_info *cast = swig_module.cast_initial[i];
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
- while (cast->type) {
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
- cast++;
- ++j;
- }
- printf("---- Total casts: %d\n",j);
- }
- printf("**** SWIG_InitializeModule: Cast List ******\n");
-#endif
-}
-
-/* This function will propagate the clientdata field of type to
-* any new swig_type_info structures that have been added into the list
-* of equivalent types. It is like calling
-* SWIG_TypeClientData(type, clientdata) a second time.
-*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
- size_t i;
- swig_cast_info *equiv;
- static int init_run = 0;
-
- if (init_run) return;
- init_run = 1;
-
- for (i = 0; i < swig_module.size; i++) {
- if (swig_module.types[i]->clientdata) {
- equiv = swig_module.types[i]->cast;
- while (equiv) {
- if (!equiv->converter) {
- if (equiv->type && !equiv->type->clientdata)
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
- }
- equiv = equiv->next;
- }
- }
- }
-}
-
-#ifdef __cplusplus
-#if 0
-{ /* c-mode */
-#endif
-}
-#endif
-
-/*
-
-*/
-#ifdef __cplusplus
-extern "C"
-#endif
-SWIGEXPORT void Init_API(void) {
- size_t i;
-
- SWIG_InitRuntime();
- mAPI = rb_define_module("SQLite3");
- mAPI = rb_define_module_under(mAPI, "Driver");
- mAPI = rb_define_module_under(mAPI, "Native");
- mAPI = rb_define_module_under(mAPI, "API");
-
- SWIG_InitializeModule(0);
- for (i = 0; i < swig_module.size; i++) {
- SWIG_define_class(swig_module.types[i]);
- }
-
- SWIG_RubyInitializeTrackings();
-
- SwigClassCallbackData.klass = rb_define_class_under(mAPI, "CallbackData", rb_cObject);
- SWIG_TypeClientData(SWIGTYPE_p_CallbackData, (void *) &SwigClassCallbackData);
- rb_define_alloc_func(SwigClassCallbackData.klass, _wrap_CallbackData_allocate);
- rb_define_method(SwigClassCallbackData.klass, "initialize", _wrap_new_CallbackData, -1);
- rb_define_method(SwigClassCallbackData.klass, "proc=", _wrap_CallbackData_proc_set, -1);
- rb_define_method(SwigClassCallbackData.klass, "proc", _wrap_CallbackData_proc_get, -1);
- rb_define_method(SwigClassCallbackData.klass, "proc2=", _wrap_CallbackData_proc2_set, -1);
- rb_define_method(SwigClassCallbackData.klass, "proc2", _wrap_CallbackData_proc2_get, -1);
- rb_define_method(SwigClassCallbackData.klass, "data=", _wrap_CallbackData_data_set, -1);
- rb_define_method(SwigClassCallbackData.klass, "data", _wrap_CallbackData_data_get, -1);
- SwigClassCallbackData.mark = (void (*)(void *)) mark_CallbackData;
- SwigClassCallbackData.destroy = (void (*)(void *)) free_CallbackData;
- SwigClassCallbackData.trackObjects = 0;
- rb_define_const(mAPI, "Sqlite3_ruby_busy_handler", SWIG_NewFunctionPtrObj((void *)Sqlite3_ruby_busy_handler, SWIGTYPE_p_f_p_void_int__int));
- rb_define_const(mAPI, "Sqlite3_ruby_authorizer", SWIG_NewFunctionPtrObj((void *)Sqlite3_ruby_authorizer, SWIGTYPE_p_f_p_void_int_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__int));
- rb_define_const(mAPI, "Sqlite3_ruby_trace", SWIG_NewFunctionPtrObj((void *)Sqlite3_ruby_trace, SWIGTYPE_p_f_p_void_p_q_const__char__void));
- rb_define_const(mAPI, "Sqlite3_ruby_function_step", SWIG_NewFunctionPtrObj((void *)Sqlite3_ruby_function_step, SWIGTYPE_p_f_p_sqlite3_context_int_p_p_sqlite3_value__void));
- rb_define_const(mAPI, "Sqlite3_ruby_function_final", SWIG_NewFunctionPtrObj((void *)Sqlite3_ruby_function_final, SWIGTYPE_p_f_p_sqlite3_context__void));
- rb_define_module_function(mAPI, "sqlite3_libversion", _wrap_sqlite3_libversion, -1);
- rb_define_module_function(mAPI, "sqlite3_close", _wrap_sqlite3_close, -1);
- rb_define_module_function(mAPI, "sqlite3_last_insert_rowid", _wrap_sqlite3_last_insert_rowid, -1);
- rb_define_module_function(mAPI, "sqlite3_changes", _wrap_sqlite3_changes, -1);
- rb_define_module_function(mAPI, "sqlite3_total_changes", _wrap_sqlite3_total_changes, -1);
- rb_define_module_function(mAPI, "sqlite3_interrupt", _wrap_sqlite3_interrupt, -1);
- rb_define_module_function(mAPI, "sqlite3_complete", _wrap_sqlite3_complete, -1);
- rb_define_module_function(mAPI, "sqlite3_complete16", _wrap_sqlite3_complete16, -1);
- rb_define_module_function(mAPI, "sqlite3_busy_handler", _wrap_sqlite3_busy_handler, -1);
- rb_define_module_function(mAPI, "sqlite3_busy_timeout", _wrap_sqlite3_busy_timeout, -1);
- rb_define_module_function(mAPI, "sqlite3_set_authorizer", _wrap_sqlite3_set_authorizer, -1);
- rb_define_module_function(mAPI, "sqlite3_trace", _wrap_sqlite3_trace, -1);
- rb_define_module_function(mAPI, "sqlite3_open", _wrap_sqlite3_open, -1);
- rb_define_module_function(mAPI, "sqlite3_open16", _wrap_sqlite3_open16, -1);
- rb_define_module_function(mAPI, "sqlite3_errcode", _wrap_sqlite3_errcode, -1);
- rb_define_module_function(mAPI, "sqlite3_errmsg", _wrap_sqlite3_errmsg, -1);
- rb_define_module_function(mAPI, "sqlite3_errmsg16", _wrap_sqlite3_errmsg16, -1);
- rb_define_module_function(mAPI, "sqlite3_prepare", _wrap_sqlite3_prepare, -1);
- rb_define_module_function(mAPI, "sqlite3_prepare16", _wrap_sqlite3_prepare16, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_blob", _wrap_sqlite3_bind_blob, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_double", _wrap_sqlite3_bind_double, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_int", _wrap_sqlite3_bind_int, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_int64", _wrap_sqlite3_bind_int64, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_null", _wrap_sqlite3_bind_null, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_text", _wrap_sqlite3_bind_text, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_text16", _wrap_sqlite3_bind_text16, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_parameter_count", _wrap_sqlite3_bind_parameter_count, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_parameter_name", _wrap_sqlite3_bind_parameter_name, -1);
- rb_define_module_function(mAPI, "sqlite3_bind_parameter_index", _wrap_sqlite3_bind_parameter_index, -1);
- rb_define_module_function(mAPI, "sqlite3_column_count", _wrap_sqlite3_column_count, -1);
- rb_define_module_function(mAPI, "sqlite3_column_name", _wrap_sqlite3_column_name, -1);
- rb_define_module_function(mAPI, "sqlite3_column_name16", _wrap_sqlite3_column_name16, -1);
- rb_define_module_function(mAPI, "sqlite3_column_decltype", _wrap_sqlite3_column_decltype, -1);
- rb_define_module_function(mAPI, "sqlite3_column_decltype16", _wrap_sqlite3_column_decltype16, -1);
- rb_define_module_function(mAPI, "sqlite3_step", _wrap_sqlite3_step, -1);
- rb_define_module_function(mAPI, "sqlite3_data_count", _wrap_sqlite3_data_count, -1);
- rb_define_module_function(mAPI, "sqlite3_column_blob", _wrap_sqlite3_column_blob, -1);
- rb_define_module_function(mAPI, "sqlite3_column_bytes", _wrap_sqlite3_column_bytes, -1);
- rb_define_module_function(mAPI, "sqlite3_column_bytes16", _wrap_sqlite3_column_bytes16, -1);
- rb_define_module_function(mAPI, "sqlite3_column_double", _wrap_sqlite3_column_double, -1);
- rb_define_module_function(mAPI, "sqlite3_column_int", _wrap_sqlite3_column_int, -1);
- rb_define_module_function(mAPI, "sqlite3_column_int64", _wrap_sqlite3_column_int64, -1);
- rb_define_module_function(mAPI, "sqlite3_column_text", _wrap_sqlite3_column_text, -1);
- rb_define_module_function(mAPI, "sqlite3_column_text16", _wrap_sqlite3_column_text16, -1);
- rb_define_module_function(mAPI, "sqlite3_column_type", _wrap_sqlite3_column_type, -1);
- rb_define_module_function(mAPI, "sqlite3_finalize", _wrap_sqlite3_finalize, -1);
- rb_define_module_function(mAPI, "sqlite3_reset", _wrap_sqlite3_reset, -1);
- rb_define_module_function(mAPI, "sqlite3_create_function", _wrap_sqlite3_create_function, -1);
- rb_define_module_function(mAPI, "sqlite3_create_function16", _wrap_sqlite3_create_function16, -1);
- rb_define_module_function(mAPI, "sqlite3_aggregate_count", _wrap_sqlite3_aggregate_count, -1);
- rb_define_module_function(mAPI, "sqlite3_value_blob", _wrap_sqlite3_value_blob, -1);
- rb_define_module_function(mAPI, "sqlite3_value_bytes", _wrap_sqlite3_value_bytes, -1);
- rb_define_module_function(mAPI, "sqlite3_value_bytes16", _wrap_sqlite3_value_bytes16, -1);
- rb_define_module_function(mAPI, "sqlite3_value_double", _wrap_sqlite3_value_double, -1);
- rb_define_module_function(mAPI, "sqlite3_value_int", _wrap_sqlite3_value_int, -1);
- rb_define_module_function(mAPI, "sqlite3_value_int64", _wrap_sqlite3_value_int64, -1);
- rb_define_module_function(mAPI, "sqlite3_value_text", _wrap_sqlite3_value_text, -1);
- rb_define_module_function(mAPI, "sqlite3_value_text16", _wrap_sqlite3_value_text16, -1);
- rb_define_module_function(mAPI, "sqlite3_value_text16le", _wrap_sqlite3_value_text16le, -1);
- rb_define_module_function(mAPI, "sqlite3_value_text16be", _wrap_sqlite3_value_text16be, -1);
- rb_define_module_function(mAPI, "sqlite3_value_type", _wrap_sqlite3_value_type, -1);
- rb_define_module_function(mAPI, "sqlite3_result_blob", _wrap_sqlite3_result_blob, -1);
- rb_define_module_function(mAPI, "sqlite3_result_double", _wrap_sqlite3_result_double, -1);
- rb_define_module_function(mAPI, "sqlite3_result_error", _wrap_sqlite3_result_error, -1);
- rb_define_module_function(mAPI, "sqlite3_result_error16", _wrap_sqlite3_result_error16, -1);
- rb_define_module_function(mAPI, "sqlite3_result_int", _wrap_sqlite3_result_int, -1);
- rb_define_module_function(mAPI, "sqlite3_result_int64", _wrap_sqlite3_result_int64, -1);
- rb_define_module_function(mAPI, "sqlite3_result_text", _wrap_sqlite3_result_text, -1);
- rb_define_module_function(mAPI, "sqlite3_result_text16", _wrap_sqlite3_result_text16, -1);
- rb_define_module_function(mAPI, "sqlite3_result_text16le", _wrap_sqlite3_result_text16le, -1);
- rb_define_module_function(mAPI, "sqlite3_result_text16be", _wrap_sqlite3_result_text16be, -1);
- rb_define_module_function(mAPI, "sqlite3_result_value", _wrap_sqlite3_result_value, -1);
- rb_define_module_function(mAPI, "sqlite3_aggregate_context", _wrap_sqlite3_aggregate_context, -1);
-}
-
diff --git a/vendor/plugins/sqlite3-ruby/ext/sqlite3_api/win32/build.bat b/vendor/plugins/sqlite3-ruby/ext/sqlite3_api/win32/build.bat
deleted file mode 100755
index 550e720f..00000000
--- a/vendor/plugins/sqlite3-ruby/ext/sqlite3_api/win32/build.bat
+++ /dev/null
@@ -1,7 +0,0 @@
-REM This is not guaranteed to work, ever. It's just a little helper
-REM script that I threw together to help me build the win32 version of
-REM the library. If someone with more win32-fu than I wants to make
-REM something more robust, please feel free! I'd love to include it.
-REM -- Jamis Buck
-
-cl /LD /Ie:\WinSDK\Include /Ic:\ruby\lib\ruby\1.8\i386-mswin32 /Ic:\ruby\sqlite3 /Ic:\ruby\src\ruby-1.8.4_2006-04-14 sqlite3_api_wrap.c /link /LIBPATH:c:\ruby\sqlite3 /LIBPATH:e:\WinSDK\Lib /LIBPATH:c:\ruby\lib sqlite3.lib msvcrt-ruby18.lib
diff --git a/vendor/plugins/sqlite3-ruby/faq/faq.rb b/vendor/plugins/sqlite3-ruby/faq/faq.rb
new file mode 100644
index 00000000..61d7d01c
--- /dev/null
+++ b/vendor/plugins/sqlite3-ruby/faq/faq.rb
@@ -0,0 +1,145 @@
+require 'yaml'
+require 'redcloth'
+
+def process_faq_list( faqs )
+ puts ""
+ faqs.each do |faq|
+ process_faq_list_item faq
+ end
+ puts "
"
+end
+
+def process_faq_list_item( faq )
+ question = faq.keys.first
+ answer = faq.values.first
+
+ print ""
+
+ question_text = RedCloth.new(question).to_html.gsub( %r{?p>},"" )
+ if answer.is_a?( Array )
+ puts question_text
+ process_faq_list answer
+ else
+ print "#{question_text}"
+ end
+
+ puts ""
+end
+
+def process_faq_descriptions( faqs, path=nil )
+ faqs.each do |faq|
+ process_faq_description faq, path
+ end
+end
+
+def process_faq_description( faq, path )
+ question = faq.keys.first
+ path = ( path ? path + " " : "" ) + question
+ answer = faq.values.first
+
+ if answer.is_a?( Array )
+ process_faq_descriptions( answer, path )
+ else
+ title = RedCloth.new( path ).to_html.gsub( %r{?p>}, "" )
+ answer = RedCloth.new( answer || "" )
+
+ puts ""
+ puts "#{title}
"
+ puts "#{add_api_links(answer.to_html)}
"
+ end
+end
+
+API_OBJECTS = [ "Database", "Statement", "ResultSet",
+ "ParsedStatement", "Pragmas", "Translator" ].inject( "(" ) { |acc,name|
+ acc << "|" if acc.length > 1
+ acc << name
+ acc
+ } + ")"
+
+def add_api_links( text )
+ text.gsub( /#{API_OBJECTS}(#(\w+))?/ ) do
+ disp_obj = obj = $1
+
+ case obj
+ when "Pragmas"; disp_obj = "Database"
+ end
+
+ method = $3
+ s = "#{disp_obj}"
+ s << "##{method}" if method
+ s << ""
+ s
+ end
+end
+
+faqs = YAML.load( File.read( "faq.yml" ) )
+
+puts <<-EOF
+
+
+ SQLite3/Ruby FAQ
+
+
+
+ SQLite/Ruby FAQ
+
+EOF
+
+process_faq_list( faqs )
+puts "
"
+process_faq_descriptions( faqs )
+
+puts ""
diff --git a/vendor/plugins/sqlite3-ruby/faq/faq.yml b/vendor/plugins/sqlite3-ruby/faq/faq.yml
new file mode 100644
index 00000000..f4bb4c1b
--- /dev/null
+++ b/vendor/plugins/sqlite3-ruby/faq/faq.yml
@@ -0,0 +1,426 @@
+---
+- "How do I do a database query?":
+ - "I just want an array of the rows...": >-
+
+ Use the Database#execute method. If you don't give it a block, it will
+ return an array of all the rows:
+
+
+
+ require 'sqlite3'
+
+ db = SQLite3::Database.new( "test.db" )
+ rows = db.execute( "select * from test" )
+
+
+ - "I'd like to use a block to iterate through the rows...": >-
+
+ Use the Database#execute method. If you give it a block, each row of the
+ result will be yielded to the block:
+
+
+
+ require 'sqlite3'
+
+ db = SQLite3::Database.new( "test.db" )
+ db.execute( "select * from test" ) do |row|
+ ...
+ end
+
+
+ - "I need to get the column names as well as the rows...": >-
+
+ Use the Database#execute2 method. This works just like Database#execute;
+ if you don't give it a block, it returns an array of rows; otherwise, it
+ will yield each row to the block. _However_, the first row returned is
+ always an array of the column names from the query:
+
+
+
+ require 'sqlite3'
+
+ db = SQLite3::Database.new( "test.db" )
+ columns, *rows = db.execute2( "select * from test" )
+
+ # or use a block:
+
+ columns = nil
+ db.execute2( "select * from test" ) do |row|
+ if columns.nil?
+ columns = row
+ else
+ # process row
+ end
+ end
+
+
+ - "I just want the first row of the result set...": >-
+
+ Easy. Just call Database#get_first_row:
+
+
+
+ row = db.get_first_row( "select * from table" )
+
+
+
+ This also supports bind variables, just like Database#execute
+ and friends.
+
+ - "I just want the first value of the first row of the result set...": >-
+
+ Also easy. Just call Database#get_first_value:
+
+
+
+ count = db.get_first_value( "select count(*) from table" )
+
+
+
+ This also supports bind variables, just like Database#execute
+ and friends.
+
+- "How do I prepare a statement for repeated execution?": >-
+ If the same statement is going to be executed repeatedly, you can speed
+ things up a bit by _preparing_ the statement. You do this via the
+ Database#prepare method. It returns a Statement object, and you can
+ then invoke #execute on that to get the ResultSet:
+
+
+
+ stmt = db.prepare( "select * from person" )
+
+ 1000.times do
+ stmt.execute do |result|
+ ...
+ end
+ end
+
+ stmt.close
+
+ # or, use a block
+
+ db.prepare( "select * from person" ) do |stmt|
+ 1000.times do
+ stmt.execute do |result|
+ ...
+ end
+ end
+ end
+
+
+
+ This is made more useful by the ability to bind variables to placeholders
+ via the Statement#bind_param and Statement#bind_params methods. (See the
+ next FAQ for details.)
+
+- "How do I use placeholders in an SQL statement?": >-
+ Placeholders in an SQL statement take any of the following formats:
+
+
+ * @?@
+
+ * @?_nnn_@
+
+ * @:_word_@
+
+
+ Where _n_ is an integer, and _word_ is an alpha-numeric identifier (or
+ number). When the placeholder is associated with a number, that number
+ identifies the index of the bind variable to replace it with. When it
+ is an identifier, it identifies the name of the correponding bind
+ variable. (In the instance of the first format--a single question
+ mark--the placeholder is assigned a number one greater than the last
+ index used, or 1 if it is the first.)
+
+
+ For example, here is a query using these placeholder formats:
+
+
+
+ select *
+ from table
+ where ( c = ?2 or c = ? )
+ and d = :name
+ and e = :1
+
+
+
+ This defines 5 different placeholders: 1, 2, 3, and "name".
+
+
+ You replace these placeholders by _binding_ them to values. This can be
+ accomplished in a variety of ways.
+
+
+ The Database#execute, and Database#execute2 methods all accept additional
+ arguments following the SQL statement. These arguments are assumed to be
+ bind parameters, and they are bound (positionally) to their corresponding
+ placeholders:
+
+
+
+ db.execute( "select * from table where a = ? and b = ?",
+ "hello",
+ "world" )
+
+
+
+ The above would replace the first question mark with 'hello' and the
+ second with 'world'. If the placeholders have an explicit index given, they
+ will be replaced with the bind parameter at that index (1-based).
+
+
+ If a Hash is given as a bind parameter, then its key/value pairs are bound
+ to the placeholders. This is how you bind by name:
+
+
+
+ db.execute( "select * from table where a = :name and b = :value",
+ "name" => "bob",
+ "value" => "priceless" )
+
+
+
+ You can also bind explicitly using the Statement object itself. Just pass
+ additional parameters to the Statement#execute statement:
+
+
+
+ db.prepare( "select * from table where a = :name and b = ?" ) do |stmt|
+ stmt.execute "value", "name" => "bob"
+ end
+
+
+
+ Or do a Database#prepare to get the Statement, and then use either
+ Statement#bind_param or Statement#bind_params:
+
+
+
+ stmt = db.prepare( "select * from table where a = :name and b = ?" )
+
+ stmt.bind_param( "name", "bob" )
+ stmt.bind_param( 1, "value" )
+
+ # or
+
+ stmt.bind_params( "value", "name" => "bob" )
+
+
+- "How do I discover metadata about a query?": >-
+
+ If you ever want to know the names or types of the columns in a result
+ set, you can do it in several ways.
+
+
+ The first way is to ask the row object itself. Each row will have a
+ property "fields" that returns an array of the column names. The row
+ will also have a property "types" that returns an array of the column
+ types:
+
+
+
+ rows = db.execute( "select * from table" )
+ p rows[0].fields
+ p rows[0].types
+
+
+
+ Obviously, this approach requires you to execute a statement that actually
+ returns data. If you don't know if the statement will return any rows, but
+ you still need the metadata, you can use Database#query and ask the
+ ResultSet object itself:
+
+
+
+ db.query( "select * from table" ) do |result|
+ p result.columns
+ p result.types
+ ...
+ end
+
+
+
+ Lastly, you can use Database#prepare and ask the Statement object what
+ the metadata are:
+
+
+
+ stmt = db.prepare( "select * from table" )
+ p stmt.columns
+ p stmt.types
+
+
+- "I'd like the rows to be indexible by column name.": >-
+ By default, each row from a query is returned as an Array of values. This
+ means that you can only obtain values by their index. Sometimes, however,
+ you would like to obtain values by their column name.
+
+
+ The first way to do this is to set the Database property "results_as_hash"
+ to true. If you do this, then all rows will be returned as Hash objects,
+ with the column names as the keys. (In this case, the "fields" property
+ is unavailable on the row, although the "types" property remains.)
+
+
+
+ db.results_as_hash = true
+ db.execute( "select * from table" ) do |row|
+ p row['column1']
+ p row['column2']
+ end
+
+
+
+ The other way is to use Ara Howard's
+ "ArrayFields":http://rubyforge.org/projects/arrayfields
+ module. Just require "arrayfields", and all of your rows will be indexable
+ by column name, even though they are still arrays!
+
+
+
+ require 'arrayfields'
+
+ ...
+ db.execute( "select * from table" ) do |row|
+ p row[0] == row['column1']
+ p row[1] == row['column2']
+ end
+
+
+- "I'd like the values from a query to be the correct types, instead of String.": >-
+ You can turn on "type translation" by setting Database#type_translation to
+ true:
+
+
+
+ db.type_translation = true
+ db.execute( "select * from table" ) do |row|
+ p row
+ end
+
+
+
+ By doing this, each return value for each row will be translated to its
+ correct type, based on its declared column type.
+
+
+ You can even declare your own translation routines, if (for example) you are
+ using an SQL type that is not handled by default:
+
+
+
+ # assume "objects" table has the following schema:
+ # create table objects (
+ # name varchar2(20),
+ # thing object
+ # )
+
+ db.type_translation = true
+ db.translator.add_translator( "object" ) do |type, value|
+ db.decode( value )
+ end
+
+ h = { :one=>:two, "three"=>"four", 5=>6 }
+ dump = db.encode( h )
+
+ db.execute( "insert into objects values ( ?, ? )", "bob", dump )
+
+ obj = db.get_first_value( "select thing from objects where name='bob'" )
+ p obj == h
+
+
+- "How do insert binary data into the database?": >-
+ Use blobs. Blobs are new features of SQLite3. You have to use bind
+ variables to make it work:
+
+
+
+ db.execute( "insert into foo ( ?, ? )",
+ SQLite3::Blob.new( "\0\1\2\3\4\5" ),
+ SQLite3::Blob.new( "a\0b\0c\0d ) )
+
+
+
+ The blob values must be indicated explicitly by binding each parameter to
+ a value of type SQLite3::Blob.
+
+- "How do I do a DDL (insert, update, delete) statement?": >-
+ You can actually do inserts, updates, and deletes in exactly the same way
+ as selects, but in general the Database#execute method will be most
+ convenient:
+
+
+
+ db.execute( "insert into table values ( ?, ? )", *bind_vars )
+
+
+- "How do I execute multiple statements in a single string?": >-
+ The standard query methods (Database#execute, Database#execute2,
+ Database#query, and Statement#execute) will only execute the first
+ statement in the string that is given to them. Thus, if you have a
+ string with multiple SQL statements, each separated by a string,
+ you can't use those methods to execute them all at once.
+
+
+ Instead, use Database#execute_batch:
+
+
+
+ sql = <
+
+
+ Unlike the other query methods, Database#execute_batch accepts no
+ block. It will also only ever return +nil+. Thus, it is really only
+ suitable for batch processing of DDL statements.
+
+- "How do I begin/end a transaction?":
+ Use Database#transaction to start a transaction. If you give it a block,
+ the block will be automatically committed at the end of the block,
+ unless an exception was raised, in which case the transaction will be
+ rolled back. (Never explicitly call Database#commit or Database#rollback
+ inside of a transaction block--you'll get errors when the block
+ terminates!)
+
+
+
+ database.transaction do |db|
+ db.execute( "insert into table values ( 'a', 'b', 'c' )" )
+ ...
+ end
+
+
+
+ Alternatively, if you don't give a block to Database#transaction, the
+ transaction remains open until you explicitly call Database#commit or
+ Database#rollback.
+
+
+
+ db.transaction
+ db.execute( "insert into table values ( 'a', 'b', 'c' )" )
+ db.commit
+
+
+
+ Note that SQLite does not allow nested transactions, so you'll get errors
+ if you try to open a new transaction while one is already active. Use
+ Database#transaction_active? to determine whether a transaction is
+ active or not.
+
+#- "How do I discover metadata about a table/index?":
+#
+#- "How do I do tweak database settings?":
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3.rb
index d2d0ea10..b17ce52d 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3.rb
@@ -1 +1,10 @@
+# support multiple ruby version (fat binaries under windows)
+begin
+ RUBY_VERSION =~ /(\d+.\d+)/
+ require "sqlite3/#{$1}/sqlite3_native"
+rescue LoadError
+ require 'sqlite3/sqlite3_native'
+end
+
require 'sqlite3/database'
+require 'sqlite3/version'
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/database.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/database.rb
index e2ba69c1..4d3522fa 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/database.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/database.rb
@@ -35,7 +35,7 @@ module SQLite3
class Database
include Pragmas
- class < e
- @driver.result_error( func,
- "#{e.message} (#{e.class})", -1 )
- end
+ def create_function name, arity, text_rep=Constants::TextRep::ANY, &block
+ define_function(name) do |*args|
+ fp = FunctionProxy.new
+ block.call(fp, *args)
+ fp.result
end
-
- result = @driver.create_function( @handle, name, arity, text_rep, nil,
- callback, nil, nil )
- Error.check( result, self )
-
self
end
@@ -410,47 +357,40 @@ module SQLite3
# aggregate functions.
def create_aggregate( name, arity, step=nil, finalize=nil,
text_rep=Constants::TextRep::ANY, &block )
- # begin
- if block
- proxy = AggregateDefinitionProxy.new
- proxy.instance_eval(&block)
- step ||= proxy.step_callback
- finalize ||= proxy.finalize_callback
- end
- step_callback = proc do |func,*args|
- ctx = @driver.aggregate_context( func )
- unless ctx[:__error]
- begin
- step.call( FunctionProxy.new( @driver, func, ctx ),
- *args.map{|v| Value.new(self,v)} )
- rescue Exception => e
- ctx[:__error] = e
- end
+ factory = Class.new do
+ def self.step( &block )
+ define_method(:step, &block)
+ end
+
+ def self.finalize( &block )
+ define_method(:finalize, &block)
end
end
- finalize_callback = proc do |func|
- ctx = @driver.aggregate_context( func )
- unless ctx[:__error]
- begin
- finalize.call( FunctionProxy.new( @driver, func, ctx ) )
- rescue Exception => e
- @driver.result_error( func,
- "#{e.message} (#{e.class})", -1 )
- end
- else
- e = ctx[:__error]
- @driver.result_error( func,
- "#{e.message} (#{e.class})", -1 )
+ if block_given?
+ factory.instance_eval(&block)
+ else
+ factory.class_eval do
+ define_method(:step, step)
+ define_method(:finalize, finalize)
end
end
- result = @driver.create_function( @handle, name, arity, text_rep, nil,
- nil, step_callback, finalize_callback )
- Error.check( result, self )
+ proxy = factory.new
+ proxy.extend(Module.new {
+ attr_accessor :ctx
- self
+ def step( *args )
+ super(@ctx, *args)
+ end
+
+ def finalize
+ super(@ctx)
+ end
+ })
+ proxy.ctx = FunctionProxy.new
+ define_aggregator(name, proxy)
end
# This is another approach to creating an aggregate function (see
@@ -500,47 +440,22 @@ module SQLite3
# db.create_aggregate_handler( LengthsAggregateHandler )
# puts db.get_first_value( "select lengths(name) from A" )
def create_aggregate_handler( handler )
- arity = -1
- text_rep = Constants::TextRep::ANY
+ proxy = Class.new do
+ def initialize handler
+ @handler = handler
+ @fp = FunctionProxy.new
+ end
- arity = handler.arity if handler.respond_to?(:arity)
- text_rep = handler.text_rep if handler.respond_to?(:text_rep)
- name = handler.name
+ def step( *args )
+ @handler.step(@fp, *args)
+ end
- step = proc do |func,*args|
- ctx = @driver.aggregate_context( func )
- unless ctx[ :__error ]
- ctx[ :handler ] ||= handler.new
- begin
- ctx[ :handler ].step( FunctionProxy.new( @driver, func, ctx ),
- *args.map{|v| Value.new(self,v)} )
- rescue Exception, StandardError => e
- ctx[ :__error ] = e
- end
+ def finalize
+ @handler.finalize @fp
+ @fp.result
end
end
-
- finalize = proc do |func|
- ctx = @driver.aggregate_context( func )
- unless ctx[ :__error ]
- ctx[ :handler ] ||= handler.new
- begin
- ctx[ :handler ].finalize( FunctionProxy.new( @driver, func, ctx ) )
- rescue Exception => e
- ctx[ :__error ] = e
- end
- end
-
- if ctx[ :__error ]
- e = ctx[ :__error ]
- @driver.sqlite3_result_error( func, "#{e.message} (#{e.class})", -1 )
- end
- end
-
- result = @driver.create_function( @handle, name, arity, text_rep, nil,
- nil, step, finalize )
- Error.check( result, self )
-
+ define_aggregator(handler.name, proxy.new(handler.new))
self
end
@@ -604,33 +519,6 @@ module SQLite3
@transaction_active
end
- # Loads the corresponding driver, or if it is nil, attempts to locate a
- # suitable driver.
- def load_driver( driver )
- case driver
- when Class
- # do nothing--use what was given
- when Symbol, String
- require "sqlite3/driver/#{driver.to_s.downcase}/driver"
- driver = SQLite3::Driver.const_get( driver )::Driver
- else
- [ "Native", "DL" ].each do |d|
- begin
- require "sqlite3/driver/#{d.downcase}/driver"
- driver = SQLite3::Driver.const_get( d )::Driver
- break
- rescue SyntaxError
- raise
- rescue ScriptError, Exception, NameError
- end
- end
- raise "no driver for sqlite3 found" unless driver
- end
-
- @driver = driver.new
- end
- private :load_driver
-
# A helper class for dealing with custom functions (see #create_function,
# #create_aggregate, and #create_aggregate_handler). It encapsulates the
# opaque function object that represents the current invocation. It also
@@ -640,26 +528,15 @@ module SQLite3
# This class will almost _always_ be instantiated indirectly, by working
# with the create methods mentioned above.
class FunctionProxy
+ attr_accessor :result
# Create a new FunctionProxy that encapsulates the given +func+ object.
# If context is non-nil, the functions context will be set to that. If
# it is non-nil, it must quack like a Hash. If it is nil, then none of
# the context functions will be available.
- def initialize( driver, func, context=nil )
- @driver = driver
- @func = func
- @context = context
- end
-
- # Calls #set_result to set the result of this function.
- def result=( result )
- set_result( result )
- end
-
- # Set the result of the function to the given value. The function will
- # then return this value.
- def set_result( result, utf16=false )
- @driver.result_text( @func, result, utf16 )
+ def initialize
+ @result = nil
+ @context = {}
end
# Set the result of the function to the given error message.
@@ -672,50 +549,20 @@ module SQLite3
# that the aggregate has processed so far. This will include the current
# row, and so will always return at least 1.
def count
- ensure_aggregate!
@driver.aggregate_count( @func )
end
# Returns the value with the given key from the context. This is only
# available to aggregate functions.
def []( key )
- ensure_aggregate!
@context[ key ]
end
# Sets the value with the given key in the context. This is only
# available to aggregate functions.
def []=( key, value )
- ensure_aggregate!
@context[ key ] = value
end
-
- # A function for performing a sanity check, to ensure that the function
- # being invoked is an aggregate function. This is implied by the
- # existence of the context variable.
- def ensure_aggregate!
- unless @context
- raise MisuseException, "function is not an aggregate"
- end
- end
- private :ensure_aggregate!
-
end
-
- # A proxy used for defining the callbacks to an aggregate function.
- class AggregateDefinitionProxy # :nodoc:
- attr_reader :step_callback, :finalize_callback
-
- def step( &block )
- @step_callback = block
- end
-
- def finalize( &block )
- @finalize_callback = block
- end
- end
-
end
-
end
-
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/dl/api.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/dl/api.rb
deleted file mode 100644
index 60a2c3d1..00000000
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/dl/api.rb
+++ /dev/null
@@ -1,152 +0,0 @@
-require 'dl/import'
-
-module SQLite3 ; module Driver; module DL;
-
- module API
- extend ::DL::Importable
-
- library_name = case RUBY_PLATFORM.downcase
- when /darwin/
- "libsqlite3.dylib"
- when /linux/, /freebsd|netbsd|openbsd|dragonfly/, /solaris/
- "libsqlite3.so"
- when /mswin|mingw/
- "sqlite3.dll"
- else
- abort <<-EOF
-== * UNSUPPORTED PLATFORM ======================================================
-The platform '#{RUBY_PLATFORM}' is unsupported. Please help the author by
-editing the following file to allow your sqlite3 library to be found, and
-submitting a patch to jamis_buck@byu.edu. Thanks!
-
-#{__FILE__}
-=========================================================================== * ==
- EOF
- end
-
- if defined? SQLITE3_LIB_PATH
- library_name = File.join( SQLITE3_LIB_PATH, library_name )
- end
-
- dlload library_name
-
- typealias "db", "void*"
- typealias "stmt", "void*"
- typealias "value", "void*"
- typealias "context", "void*"
-
- # until Ruby/DL supports 64-bit ints, we'll just treat them as 32-bit ints
- typealias "int64", "unsigned long"
-
- extern "const char *sqlite3_libversion()"
-
- extern "int sqlite3_open(const char*,db*)"
- extern "int sqlite3_open16(const void*,db*)"
- extern "int sqlite3_close(db)"
- extern "const char* sqlite3_errmsg(db)"
- extern "void* sqlite3_errmsg16(db)"
- extern "int sqlite3_errcode(db)"
-
- extern "int sqlite3_prepare(db,const char*,int,stmt*,const char**)"
- extern "int sqlite3_prepare16(db,const void*,int,stmt*,const void**)"
- extern "int sqlite3_finalize(stmt)"
- extern "int sqlite3_reset(stmt)"
- extern "int sqlite3_step(stmt)"
-
- extern "int64 sqlite3_last_insert_rowid(db)"
- extern "int sqlite3_changes(db)"
- extern "int sqlite3_total_changes(db)"
- extern "void sqlite3_interrupt(db)"
- extern "ibool sqlite3_complete(const char*)"
- extern "ibool sqlite3_complete16(const void*)"
-
- extern "int sqlite3_busy_handler(db,void*,void*)"
- extern "int sqlite3_busy_timeout(db,int)"
-
- extern "int sqlite3_set_authorizer(db,void*,void*)"
- extern "void* sqlite3_trace(db,void*,void*)"
-
- extern "int sqlite3_bind_blob(stmt,int,const void*,int,void*)"
- extern "int sqlite3_bind_double(stmt,int,double)"
- extern "int sqlite3_bind_int(stmt,int,int)"
- extern "int sqlite3_bind_int64(stmt,int,int64)"
- extern "int sqlite3_bind_null(stmt,int)"
- extern "int sqlite3_bind_text(stmt,int,const char*,int,void*)"
- extern "int sqlite3_bind_text16(stmt,int,const void*,int,void*)"
- #extern "int sqlite3_bind_value(stmt,int,value)"
-
- extern "int sqlite3_bind_parameter_count(stmt)"
- extern "const char* sqlite3_bind_parameter_name(stmt,int)"
- extern "int sqlite3_bind_parameter_index(stmt,const char*)"
-
- extern "int sqlite3_column_count(stmt)"
- extern "int sqlite3_data_count(stmt)"
-
- extern "const void *sqlite3_column_blob(stmt,int)"
- extern "int sqlite3_column_bytes(stmt,int)"
- extern "int sqlite3_column_bytes16(stmt,int)"
- extern "const char *sqlite3_column_decltype(stmt,int)"
- extern "void *sqlite3_column_decltype16(stmt,int)"
- extern "double sqlite3_column_double(stmt,int)"
- extern "int sqlite3_column_int(stmt,int)"
- extern "int64 sqlite3_column_int64(stmt,int)"
- extern "const char *sqlite3_column_name(stmt,int)"
- extern "const void *sqlite3_column_name16(stmt,int)"
- extern "const char *sqlite3_column_text(stmt,int)"
- extern "const void *sqlite3_column_text16(stmt,int)"
- extern "int sqlite3_column_type(stmt,int)"
-
- extern "int sqlite3_create_function(db,const char*,int,int,void*,void*,void*,void*)"
- extern "int sqlite3_create_function16(db,const void*,int,int,void*,void*,void*,void*)"
- extern "int sqlite3_aggregate_count(context)"
-
- extern "const void *sqlite3_value_blob(value)"
- extern "int sqlite3_value_bytes(value)"
- extern "int sqlite3_value_bytes16(value)"
- extern "double sqlite3_value_double(value)"
- extern "int sqlite3_value_int(value)"
- extern "int64 sqlite3_value_int64(value)"
- extern "const char* sqlite3_value_text(value)"
- extern "const void* sqlite3_value_text16(value)"
- extern "const void* sqlite3_value_text16le(value)"
- extern "const void* sqlite3_value_text16be(value)"
- extern "int sqlite3_value_type(value)"
-
- extern "void *sqlite3_aggregate_context(context,int)"
- extern "void *sqlite3_user_data(context)"
- extern "void *sqlite3_get_auxdata(context,int)"
- extern "void sqlite3_set_auxdata(context,int,void*,void*)"
-
- extern "void sqlite3_result_blob(context,const void*,int,void*)"
- extern "void sqlite3_result_double(context,double)"
- extern "void sqlite3_result_error(context,const char*,int)"
- extern "void sqlite3_result_error16(context,const void*,int)"
- extern "void sqlite3_result_int(context,int)"
- extern "void sqlite3_result_int64(context,int64)"
- extern "void sqlite3_result_null(context)"
- extern "void sqlite3_result_text(context,const char*,int,void*)"
- extern "void sqlite3_result_text16(context,const void*,int,void*)"
- extern "void sqlite3_result_text16le(context,const void*,int,void*)"
- extern "void sqlite3_result_text16be(context,const void*,int,void*)"
- extern "void sqlite3_result_value(context,value)"
-
- extern "int sqlite3_create_collation(db,const char*,int,void*,void*)"
- extern "int sqlite3_create_collation16(db,const char*,int,void*,void*)"
- extern "int sqlite3_collation_needed(db,void*,void*)"
- extern "int sqlite3_collation_needed16(db,void*,void*)"
-
- # ==== CRYPTO (NOT IN PUBLIC RELEASE) ====
- if defined?( CRYPTO_API ) && CRYPTO_API
- extern "int sqlite3_key(db,void*,int)"
- extern "int sqlite3_rekey(db,void*,int)"
- end
-
- # ==== EXPERIMENTAL ====
- if defined?( EXPERIMENTAL_API ) && EXPERIMENTAL_API
- extern "int sqlite3_progress_handler(db,int,void*,void*)"
- extern "int sqlite3_commit_hook(db,void*,void*)"
- end
-
- end
-
-end ; end ; end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/dl/driver.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/dl/driver.rb
deleted file mode 100644
index f53c1897..00000000
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/dl/driver.rb
+++ /dev/null
@@ -1,307 +0,0 @@
-require 'sqlite3/driver/dl/api'
-
-warn "The DL driver for sqlite3-ruby is deprecated and will be removed"
-warn "in a future release. Please update your installation to use the"
-warn "Native driver."
-
-module Kernel
- # Allows arbitrary objects to be passed as a pointer to functions.
- # (Probably not very GC safe, but by encapsulating it like this we
- # can change the implementation later.)
- def to_ptr
- ptr = DL.malloc(DL.sizeof("L"))
- ptr.set_object self
- ptr
- end
-end
-
-class DL::PtrData
- # The inverse of the Kernel#to_ptr operation.
- def to_object
- n = to_s(4).unpack("L").first
- return nil if n < 1
- ObjectSpace._id2ref(n) rescue self.to_s
- end
-
- def set_object(obj)
- self[0] = [obj.object_id].pack("L")
- end
-end
-
-module SQLite3 ; module Driver ; module DL
-
- class Driver
- STATIC = ::DL::PtrData.new(0)
- TRANSIENT = ::DL::PtrData.new(-1)
-
- def open( filename, utf16=false )
- handle = ::DL::PtrData.new(0)
- result = API.send( ( utf16 ? :sqlite3_open16 : :sqlite3_open ),
- filename+"\0", handle.ref )
- [ result, handle ]
- end
-
- def errmsg( db, utf16=false )
- if utf16
- msg = API.sqlite3_errmsg16( db )
- msg.free = nil
- msg.to_s(utf16_length(msg))
- else
- API.sqlite3_errmsg( db )
- end
- end
-
- def prepare( db, sql, utf16=false )
- handle = ::DL::PtrData.new(0)
- remainder = ::DL::PtrData.new(0)
-
- result = API.send( ( utf16 ? :sqlite3_prepare16 : :sqlite3_prepare ),
- db, sql+"\0", sql.length, handle.ref, remainder.ref )
-
- args = utf16 ? [ utf16_length(remainder) ] : []
- remainder = remainder.to_s( *args )
-
- [ result, handle, remainder ]
- end
-
- def complete?( sql, utf16=false )
- API.send( utf16 ? :sqlite3_complete16 : :sqlite3_complete, sql+"\0" )
- end
-
- def value_blob( value )
- blob = API.sqlite3_value_blob( value )
- blob.free = nil
- blob.to_s( API.sqlite3_value_bytes( value ) )
- end
-
- def value_text( value, utf16=false )
- method = case utf16
- when nil, false then :sqlite3_value_text
- when :le then :sqlite3_value_text16le
- when :be then :sqlite3_value_text16be
- else :sqlite3_value_text16
- end
-
- result = API.send( method, value )
- if utf16
- result.free = nil
- size = API.sqlite3_value_bytes( value )
- result = result.to_s( size )
- end
-
- result
- end
-
- def column_blob( stmt, column )
- blob = API.sqlite3_column_blob( stmt, column )
- blob.free = nil
- blob.to_s( API.sqlite3_column_bytes( stmt, column ) )
- end
-
- def result_text( func, text, utf16=false )
- method = case utf16
- when false, nil then :sqlite3_result_text
- when :le then :sqlite3_result_text16le
- when :be then :sqlite3_result_text16be
- else :sqlite3_result_text16
- end
-
- s = text.to_s
- API.send( method, func, s, s.length, TRANSIENT )
- end
-
- def busy_handler( db, data=nil, &block )
- @busy_handler = block
-
- unless @busy_handler_callback
- @busy_handler_callback = ::DL.callback( "IPI" ) do |cookie, timeout|
- @busy_handler.call( cookie, timeout ) || 0
- end
- end
-
- API.sqlite3_busy_handler( db, block&&@busy_handler_callback, data )
- end
-
- def set_authorizer( db, data=nil, &block )
- @authorizer_handler = block
-
- unless @authorizer_handler_callback
- @authorizer_handler_callback = ::DL.callback( "IPIPPPP"
- ) do |cookie,mode,a,b,c,d|
- @authorizer_handler.call( cookie, mode,
- a&&a.to_s, b&&b.to_s, c&&c.to_s, d&&d.to_s ) || 0
- end
- end
-
- API.sqlite3_set_authorizer( db, block&&@authorizer_handler_callback,
- data )
- end
-
- def trace( db, data=nil, &block )
- @trace_handler = block
-
- unless @trace_handler_callback
- @trace_handler_callback = ::DL.callback( "IPS" ) do |cookie,sql|
- @trace_handler.call( cookie ? cookie.to_object : nil, sql ) || 0
- end
- end
-
- API.sqlite3_trace( db, block&&@trace_handler_callback, data )
- end
-
- def create_function( db, name, args, text, cookie,
- func, step, final )
- # begin
- if @func_handler_callback.nil? && func
- @func_handler_callback = ::DL.callback( "0PIP" ) do |context,nargs,args|
- args = args.to_s(nargs*4).unpack("L*").map {|i| ::DL::PtrData.new(i)}
- data = API.sqlite3_user_data( context ).to_object
- data[:func].call( context, *args )
- end
- end
-
- if @step_handler_callback.nil? && step
- @step_handler_callback = ::DL.callback( "0PIP" ) do |context,nargs,args|
- args = args.to_s(nargs*4).unpack("L*").map {|i| ::DL::PtrData.new(i)}
- data = API.sqlite3_user_data( context ).to_object
- data[:step].call( context, *args )
- end
- end
-
- if @final_handler_callback.nil? && final
- @final_handler_callback = ::DL.callback( "0P" ) do |context|
- data = API.sqlite3_user_data( context ).to_object
- data[:final].call( context )
- end
- end
-
- data = { :cookie => cookie,
- :name => name,
- :func => func,
- :step => step,
- :final => final }
-
- API.sqlite3_create_function( db, name, args, text, data,
- ( func ? @func_handler_callback : nil ),
- ( step ? @step_handler_callback : nil ),
- ( final ? @final_handler_callback : nil ) )
- end
-
- def aggregate_context( context )
- ptr = API.sqlite3_aggregate_context( context, 4 )
- ptr.free = nil
- obj = ( ptr ? ptr.to_object : nil )
- if obj.nil?
- obj = Hash.new
- ptr.set_object obj
- end
- obj
- end
-
- def bind_blob( stmt, index, value )
- s = value.to_s
- API.sqlite3_bind_blob( stmt, index, s, s.length, TRANSIENT )
- end
-
- def bind_text( stmt, index, value, utf16=false )
- s = value.to_s
- method = ( utf16 ? :sqlite3_bind_text16 : :sqlite3_bind_text )
- API.send( method, stmt, index, s, s.length, TRANSIENT )
- end
-
- def column_text( stmt, column )
- result = API.sqlite3_column_text( stmt, column )
- result ? result.to_s : nil
- end
-
- def column_name( stmt, column )
- result = API.sqlite3_column_name( stmt, column )
- result ? result.to_s : nil
- end
-
- def column_decltype( stmt, column )
- result = API.sqlite3_column_decltype( stmt, column )
- result ? result.to_s : nil
- end
-
- def self.api_delegate( name )
- define_method( name ) { |*args| API.send( "sqlite3_#{name}", *args ) }
- end
-
- api_delegate :aggregate_count
- api_delegate :bind_double
- api_delegate :bind_int
- api_delegate :bind_int64
- api_delegate :bind_null
- api_delegate :bind_parameter_index
- api_delegate :bind_parameter_name
- api_delegate :busy_timeout
- api_delegate :changes
- api_delegate :close
- api_delegate :column_bytes
- api_delegate :column_bytes16
- api_delegate :column_count
- api_delegate :column_double
- api_delegate :column_int
- api_delegate :column_int64
- api_delegate :column_type
- api_delegate :data_count
- api_delegate :errcode
- api_delegate :finalize
- api_delegate :interrupt
- api_delegate :last_insert_rowid
- api_delegate :libversion
- api_delegate :reset
- api_delegate :result_error
- api_delegate :step
- api_delegate :total_changes
- api_delegate :value_bytes
- api_delegate :value_bytes16
- api_delegate :value_double
- api_delegate :value_int
- api_delegate :value_int64
- api_delegate :value_type
-
- # ==== EXPERIMENTAL ====
- if defined?( EXPERIMENTAL_API ) && EXPERIMENTAL_API
- def progress_handler( db, n, data=nil, &block )
- @progress_handler = block
-
- unless @progress_handler_callback
- @progress_handler_callback = ::DL.callback( "IP" ) do |cookie|
- @progress_handler.call( cookie )
- end
- end
-
- API.sqlite3_progress_handler( db, n, block&&@progress_handler_callback,
- data )
- end
-
- def commit_hook( db, data=nil, &block )
- @commit_hook_handler = block
-
- unless @commit_hook_handler_callback
- @commit_hook_handler_callback = ::DL.callback( "IP" ) do |cookie|
- @commit_hook_handler.call( cookie )
- end
- end
-
- API.sqlite3_commit_hook( db, block&&@commit_hook_handler_callback,
- data )
- end
- end
-
- private
-
- def utf16_length(ptr)
- len = 0
- loop do
- break if ptr[len,1] == "\0"
- len += 2
- end
- len
- end
-
- end
-
-end ; end ; end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/native/driver.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/native/driver.rb
deleted file mode 100644
index 1cf0f826..00000000
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/driver/native/driver.rb
+++ /dev/null
@@ -1,219 +0,0 @@
-# support multiple ruby version (fat binaries under windows)
-begin
- require 'sqlite3_api'
-rescue LoadError
- if RUBY_PLATFORM =~ /mingw|mswin/ then
- RUBY_VERSION =~ /(\d+.\d+)/
- require "#{$1}/sqlite3_api"
- end
-end
-
-module SQLite3 ; module Driver ; module Native
-
- class Driver
-
- def initialize
- @callback_data = Hash.new
- @authorizer = Hash.new
- @busy_handler = Hash.new
- @trace = Hash.new
- end
-
- def complete?( sql, utf16=false )
- API.send( utf16 ? :sqlite3_complete16 : :sqlite3_complete, sql ) != 0
- end
-
- def busy_handler( db, data=nil, &block )
- if block
- cb = API::CallbackData.new
- cb.proc = block
- cb.data = data
- result = API.sqlite3_busy_handler( db, API::Sqlite3_ruby_busy_handler, cb )
- # Reference the Callback object so that
- # it is not deleted by the GC
- @busy_handler[db] = cb
- else
- # Unreference the callback *after* having removed it
- # from sqlite
- result = API.sqlite3_busy_handler( db, nil, nil )
- @busy_handler.delete(db)
- end
-
- result
- end
-
- def set_authorizer( db, data=nil, &block )
- if block
- cb = API::CallbackData.new
- cb.proc = block
- cb.data = data
- result = API.sqlite3_set_authorizer( db, API::Sqlite3_ruby_authorizer, cb )
- @authorizer[db] = cb # see comments in busy_handler
- else
- result = API.sqlite3_set_authorizer( db, nil, nil )
- @authorizer.delete(db) # see comments in busy_handler
- end
-
- result
- end
-
- def trace( db, data=nil, &block )
- if block
- cb = API::CallbackData.new
- cb.proc = block
- cb.data = data
- result = API.sqlite3_trace( db, API::Sqlite3_ruby_trace, cb )
- @trace[db] = cb # see comments in busy_handler
- else
- result = API.sqlite3_trace( db, nil, nil )
- @trace.delete(db) # see comments in busy_handler
- end
-
- result
- end
-
- def open( filename, utf16=false )
- API.send( utf16 ? :sqlite3_open16 : :sqlite3_open, filename )
- end
-
- def errmsg( db, utf16=false )
- API.send( utf16 ? :sqlite3_errmsg16 : :sqlite3_errmsg, db )
- end
-
- def prepare( db, sql, utf16=false )
- API.send( ( utf16 ? :sqlite3_prepare16 : :sqlite3_prepare ),
- db, sql )
- end
-
- def bind_text( stmt, index, value, utf16=false )
- API.send( ( utf16 ? :sqlite3_bind_text16 : :sqlite3_bind_text ),
- stmt, index, value.to_s )
- end
-
- def column_name( stmt, index, utf16=false )
- API.send( ( utf16 ? :sqlite3_column_name16 : :sqlite3_column_name ),
- stmt, index )
- end
-
- def column_decltype( stmt, index, utf16=false )
- API.send(
- ( utf16 ? :sqlite3_column_decltype16 : :sqlite3_column_decltype ),
- stmt, index )
- end
-
- def column_text( stmt, index, utf16=false )
- API.send( ( utf16 ? :sqlite3_column_text16 : :sqlite3_column_text ),
- stmt, index )
- end
-
- def create_function( db, name, args, text, cookie, func, step, final )
- if func || ( step && final )
- cb = API::CallbackData.new
- cb.proc = cb.proc2 = nil
- cb.data = cookie
- end
-
- if func
- cb.proc = func
-
- func = API::Sqlite3_ruby_function_step
- step = final = nil
- elsif step && final
- cb.proc = step
- cb.proc2 = final
-
- func = nil
- step = API::Sqlite3_ruby_function_step
- final = API::Sqlite3_ruby_function_final
- end
-
- result = API.sqlite3_create_function( db, name, args, text, cb, func, step, final )
-
- # see comments in busy_handler
- if cb
- @callback_data[ name ] = cb
- else
- @callback_data.delete( name )
- end
-
- return result
- end
-
- def value_text( value, utf16=false )
- method = case utf16
- when nil, false then :sqlite3_value_text
- when :le then :sqlite3_value_text16le
- when :be then :sqlite3_value_text16be
- else :sqlite3_value_text16
- end
-
- API.send( method, value )
- end
-
- def result_text( context, result, utf16=false )
- method = case utf16
- when nil, false then :sqlite3_result_text
- when :le then :sqlite3_result_text16le
- when :be then :sqlite3_result_text16be
- else :sqlite3_result_text16
- end
-
- API.send( method, context, result.to_s )
- end
-
- def result_error( context, value, utf16=false )
- API.send( ( utf16 ? :sqlite3_result_error16 : :sqlite3_result_error ),
- context, value )
- end
-
- def self.api_delegate( name )
- eval "def #{name} (*args) API.sqlite3_#{name}( *args ) ; end"
- end
-
- api_delegate :libversion
- api_delegate :close
- api_delegate :last_insert_rowid
- api_delegate :changes
- api_delegate :total_changes
- api_delegate :interrupt
- api_delegate :busy_timeout
- api_delegate :errcode
- api_delegate :bind_blob
- api_delegate :bind_double
- api_delegate :bind_int
- api_delegate :bind_int64
- api_delegate :bind_null
- api_delegate :bind_parameter_count
- api_delegate :bind_parameter_name
- api_delegate :bind_parameter_index
- api_delegate :column_count
- api_delegate :step
- api_delegate :data_count
- api_delegate :column_blob
- api_delegate :column_bytes
- api_delegate :column_bytes16
- api_delegate :column_double
- api_delegate :column_int
- api_delegate :column_int64
- api_delegate :column_type
- api_delegate :finalize
- api_delegate :reset
- api_delegate :aggregate_count
- api_delegate :value_blob
- api_delegate :value_bytes
- api_delegate :value_bytes16
- api_delegate :value_double
- api_delegate :value_int
- api_delegate :value_int64
- api_delegate :value_type
- api_delegate :result_blob
- api_delegate :result_double
- api_delegate :result_int
- api_delegate :result_int64
- api_delegate :result_null
- api_delegate :result_value
- api_delegate :aggregate_context
-
- end
-
-end ; end ; end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/errors.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/errors.rb
index b2014453..3936a594 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/errors.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/errors.rb
@@ -1,7 +1,6 @@
require 'sqlite3/constants'
module SQLite3
-
class Exception < ::StandardError
@code = 0
@@ -42,27 +41,4 @@ module SQLite3
class FormatException < Exception; end
class RangeException < Exception; end
class NotADatabaseException < Exception; end
-
- EXCEPTIONS = [
- nil,
- SQLException, InternalException, PermissionException,
- AbortException, BusyException, LockedException, MemoryException,
- ReadOnlyException, InterruptException, IOException, CorruptException,
- NotFoundException, FullException, CantOpenException, ProtocolException,
- EmptyException, SchemaChangedException, TooBigException,
- ConstraintException, MismatchException, MisuseException,
- UnsupportedException, AuthorizationException, FormatException,
- RangeException, NotADatabaseException
- ].each_with_index { |e,i| e.instance_variable_set( :@code, i ) if e }
-
- module Error
- def check( result, db=nil, msg=nil )
- unless result == Constants::ErrorCode::OK
- msg = ( msg ? msg + ": " : "" ) + db.errmsg if db
- raise(( EXCEPTIONS[result] || SQLite3::Exception ), msg)
- end
- end
- module_function :check
- end
-
end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/pragmas.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/pragmas.rb
index 52bda1a1..2e319387 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/pragmas.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/pragmas.rb
@@ -213,16 +213,24 @@ module SQLite3
get_query_pragma "index_list", table, &block
end
- def table_info( table, &block ) # :yields: row
- columns, *rows = execute2("PRAGMA table_info(#{table})")
+ ###
+ # Returns information about +table+. Yields each row of table information
+ # if a block is provided.
+ def table_info table
+ stmt = prepare "PRAGMA table_info(#{table})"
+ columns = stmt.columns
- needs_tweak_default = version_compare(driver.libversion, "3.3.7") > 0
+ needs_tweak_default =
+ version_compare(SQLite3.libversion.to_s, "3.3.7") > 0
result = [] unless block_given?
- rows.each do |row|
- new_row = {}
- columns.each_with_index do |name, index|
- new_row[name] = row[index]
+ stmt.each do |row|
+ new_row = Hash[*columns.zip(row).flatten]
+
+ # FIXME: This should be removed but is required for older versions
+ # of rails
+ if(Object.const_defined?(:ActiveRecord))
+ new_row['notnull'] = new_row['notnull'].to_s
end
tweak_default(new_row) if needs_tweak_default
@@ -233,6 +241,7 @@ module SQLite3
result << new_row
end
end
+ stmt.close
result
end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/resultset.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/resultset.rb
index 66c671c2..bc331b08 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/resultset.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/resultset.rb
@@ -31,46 +31,22 @@ module SQLite3
# Create a new ResultSet attached to the given database, using the
# given sql text.
- def initialize( db, stmt )
- @db = db
- @driver = @db.driver
+ def initialize db, stmt
+ @db = db
@stmt = stmt
- commence
end
- # A convenience method for compiling the virtual machine and stepping
- # to the first row of the result set.
- def commence
- result = @driver.step( @stmt.handle )
- if result == Constants::ErrorCode::ERROR
- @driver.reset( @stmt.handle )
- end
- check result
- @first_row = true
- end
- private :commence
-
- def check( result )
- @eof = ( result == Constants::ErrorCode::DONE )
- found = ( result == Constants::ErrorCode::ROW )
- Error.check( result, @db ) unless @eof || found
- end
- private :check
-
# Reset the cursor, so that a result set which has reached end-of-file
# can be rewound and reiterated.
def reset( *bind_params )
- @stmt.must_be_open!
- @stmt.reset!(false)
- @driver.reset( @stmt.handle )
+ @stmt.reset!
@stmt.bind_params( *bind_params )
@eof = false
- commence
end
# Query whether the cursor has reached the end of the result set or not.
def eof?
- @eof
+ @stmt.done?
end
# Obtain the next row from the cursor. If there are no more rows to be
@@ -87,69 +63,39 @@ module SQLite3
# For hashes, the column names are the keys of the hash, and the column
# types are accessible via the +types+ property.
def next
- return nil if @eof
+ row = @stmt.step
+ return nil if @stmt.done?
- @stmt.must_be_open!
-
- unless @first_row
- result = @driver.step( @stmt.handle )
- check result
+ if @db.type_translation
+ row = @stmt.types.zip(row).map do |type, value|
+ @db.translator.translate( type, value )
+ end
end
- @first_row = false
-
- unless @eof
- row = []
- @driver.data_count( @stmt.handle ).times do |column|
- type = @driver.column_type( @stmt.handle, column )
-
- if type == Constants::ColumnType::TEXT
- row << @driver.column_text( @stmt.handle, column )
- elsif type == Constants::ColumnType::NULL
- row << nil
- elsif type == Constants::ColumnType::BLOB
- row << @driver.column_blob( @stmt.handle, column )
- else
- row << @driver.column_text( @stmt.handle, column )
- end
- end
-
- if @db.type_translation
- row = @stmt.types.zip( row ).map do |type, value|
- @db.translator.translate( type, value )
- end
- end
-
- if @db.results_as_hash
- new_row = HashWithTypes[ *( @stmt.columns.zip( row ).to_a.flatten ) ]
- row.each_with_index { |value,idx|
- value.taint
- new_row[idx] = value
- }
- row = new_row
+ if @db.results_as_hash
+ new_row = HashWithTypes[*@stmt.columns.zip(row).flatten]
+ row.each_with_index { |value,idx|
+ new_row[idx] = value
+ }
+ row = new_row
+ else
+ if row.respond_to?(:fields)
+ row = ArrayWithTypes.new(row)
else
- if row.respond_to?(:fields)
- row = ArrayWithTypes.new(row)
- else
- row = ArrayWithTypesAndFields.new(row)
- end
- row.fields = @stmt.columns
- row.each { |column| column.taint }
+ row = ArrayWithTypesAndFields.new(row)
end
-
- row.types = @stmt.types
-
- return row
+ row.fields = @stmt.columns
end
- nil
+ row.types = @stmt.types
+ row
end
# Required by the Enumerable mixin. Provides an internal iterator over the
# rows of the result set.
- def each
- while row=self.next
- yield row
+ def each( &block )
+ while node = self.next
+ yield node
end
end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/statement.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/statement.rb
index fd9a3060..ade99ef4 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/statement.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/statement.rb
@@ -8,51 +8,17 @@ class String
end
module SQLite3
-
- # A class for differentiating between strings and blobs, when binding them
- # into statements.
- class Blob < String; end
-
# A statement represents a prepared-but-unexecuted SQL query. It will rarely
# (if ever) be instantiated directly by a client, and is most often obtained
# via the Database#prepare method.
class Statement
+ include Enumerable
# This is any text that followed the first valid SQL statement in the text
# with which the statement was initialized. If there was no trailing text,
# this will be the empty string.
attr_reader :remainder
- # The underlying opaque handle used to access the SQLite @driver.
- attr_reader :handle
-
- # Create a new statement attached to the given Database instance, and which
- # encapsulates the given SQL text. If the text contains more than one
- # statement (i.e., separated by semicolons), then the #remainder property
- # will be set to the trailing text.
- def initialize( db, sql, utf16=false )
- raise ArgumentError, "nil argument passed as sql text" unless sql
- @db = db
- @driver = @db.driver
- @closed = false
- @results = @columns = nil
- result, @handle, @remainder = @driver.prepare( @db.handle, sql )
- Error.check( result, @db )
- end
-
- # Closes the statement by finalizing the underlying statement
- # handle. The statement must not be used after being closed.
- def close
- must_be_open!
- @closed = true
- @driver.finalize( @handle )
- end
-
- # Returns true if the underlying statement has been closed.
- def closed?
- @closed
- end
-
# Binds the given variables to the corresponding placeholders in the SQL
# text.
#
@@ -78,42 +44,6 @@ module SQLite3
end
end
- # Binds value to the named (or positional) placeholder. If +param+ is a
- # Fixnum, it is treated as an index for a positional placeholder.
- # Otherwise it is used as the name of the placeholder to bind to.
- #
- # See also #bind_params.
- def bind_param( param, value )
- must_be_open!
- reset! if active?
- if Fixnum === param
- case value
- when Bignum then
- @driver.bind_int64( @handle, param, value )
- when Integer then
- if value >= (2 ** 31)
- @driver.bind_int64( @handle, param, value )
- else
- @driver.bind_int( @handle, param, value )
- end
- when Numeric then
- @driver.bind_double( @handle, param, value.to_f )
- when Blob then
- @driver.bind_blob( @handle, param, value )
- when nil then
- @driver.bind_null( @handle, param )
- else
- @driver.bind_text( @handle, param, value )
- end
- else
- param = param.to_s
- param = ":#{param}" unless param[0] == ?:
- index = @driver.bind_parameter_index( @handle, param )
- raise Exception, "no such bind parameter '#{param}'" if index == 0
- bind_param index, value
- end
- end
-
# Execute the statement. This creates a new ResultSet object for the
# statement's virtual machine. If a block was given, the new ResultSet will
# be yielded to it; otherwise, the ResultSet will be returned.
@@ -129,17 +59,13 @@ module SQLite3
#
# See also #bind_params, #execute!.
def execute( *bind_vars )
- must_be_open!
- reset! if active?
+ reset! if active? || done?
bind_params(*bind_vars) unless bind_vars.empty?
- @results = ResultSet.new( @db, self )
+ @results = ResultSet.new(@connection, self)
- if block_given?
- yield @results
- else
- return @results
- end
+ yield @results if block_given?
+ @results
end
# Execute the statement. If no block was given, this returns an array of
@@ -156,30 +82,15 @@ module SQLite3
# end
#
# See also #bind_params, #execute.
- def execute!( *bind_vars )
- result = execute( *bind_vars )
- rows = [] unless block_given?
- while row = result.next
- if block_given?
- yield row
- else
- rows << row
- end
- end
- rows
- end
-
- # Resets the statement. This is typically done internally, though it might
- # occassionally be necessary to manually reset the statement.
- def reset!(clear_result=true)
- @driver.reset(@handle)
- @results = nil if clear_result
+ def execute!( *bind_vars, &block )
+ execute(*bind_vars)
+ block_given? ? each(&block) : to_a
end
# Returns true if the statement is currently active, meaning it has an
# open result set.
def active?
- not @results.nil?
+ !done?
end
# Return an array of the column names for this statement. Note that this
@@ -190,11 +101,20 @@ module SQLite3
return @columns
end
+ def each
+ loop do
+ val = step
+ break self if done?
+ yield val
+ end
+ end
+
# Return an array of the data types for each column in this statement. Note
# that this may execute the statement in order to obtain the metadata; this
# makes it a (potentially) expensive operation.
def types
- get_metadata unless defined?(@types)
+ must_be_open!
+ get_metadata unless @types
@types
end
@@ -202,15 +122,12 @@ module SQLite3
# that this will actually execute the SQL, which means it can be a
# (potentially) expensive operation.
def get_metadata
- must_be_open!
-
@columns = []
@types = []
- column_count = @driver.column_count( @handle )
column_count.times do |column|
- @columns << @driver.column_name( @handle, column )
- @types << @driver.column_decltype( @handle, column )
+ @columns << column_name(column)
+ @types << column_decltype(column)
end
@columns.freeze
@@ -221,11 +138,9 @@ module SQLite3
# Performs a sanity check to ensure that the statement is not
# closed. If it is, an exception is raised.
def must_be_open! # :nodoc:
- if @closed
+ if closed?
raise SQLite3::Exception, "cannot use a closed statement"
end
end
-
end
-
end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/translator.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/translator.rb
index 1635e982..cae36941 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/translator.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/translator.rb
@@ -44,7 +44,12 @@ module SQLite3
# and are always passed straight through regardless of the type parameter.
def translate( type, value )
unless value.nil?
- @translators[ type_name( type ) ].call( type, value )
+ # FIXME: this is a hack to support Sequel
+ if type && %w{ datetime timestamp }.include?(type.downcase)
+ @translators[ type_name( type ) ].call( type, value.to_s )
+ else
+ @translators[ type_name( type ) ].call( type, value )
+ end
end
end
diff --git a/vendor/plugins/sqlite3-ruby/lib/sqlite3/version.rb b/vendor/plugins/sqlite3-ruby/lib/sqlite3/version.rb
index b162acde..71575622 100644
--- a/vendor/plugins/sqlite3-ruby/lib/sqlite3/version.rb
+++ b/vendor/plugins/sqlite3-ruby/lib/sqlite3/version.rb
@@ -3,14 +3,14 @@ module SQLite3
module Version
MAJOR = 1
- MINOR = 2
- TINY = 5
+ MINOR = 3
+ TINY = 0
BUILD = nil
STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
#:beta-tag:
- VERSION = '1.2.5'
+ VERSION = '1.3.0'
end
end
diff --git a/vendor/plugins/sqlite3-ruby/setup.rb b/vendor/plugins/sqlite3-ruby/setup.rb
index 5f22fc1f..82b45091 100644
--- a/vendor/plugins/sqlite3-ruby/setup.rb
+++ b/vendor/plugins/sqlite3-ruby/setup.rb
@@ -481,7 +481,7 @@ module FileOperations
end
def extdir?(dir)
- File.exist?(dir + '/MANIFEST')
+ File.exist?(dir + '/MANIFEST') or File.exist?("#{dir}/extconf.rb")
end
def all_files_in(dirname)
@@ -1149,7 +1149,7 @@ class Installer
def install_dir_ext(rel)
return unless extdir?(curr_srcdir())
install_files ruby_extentions('.'),
- "#{config('so-dir')}/#{File.dirname(rel)}",
+ "#{config('so-dir')}/#{rel}",
0555
end
diff --git a/vendor/plugins/sqlite3-ruby/sqlite3-ruby.gemspec b/vendor/plugins/sqlite3-ruby/sqlite3-ruby.gemspec
deleted file mode 100644
index c8495011..00000000
--- a/vendor/plugins/sqlite3-ruby/sqlite3-ruby.gemspec
+++ /dev/null
@@ -1,141 +0,0 @@
---- !ruby/object:Gem::Specification
-name: sqlite3-ruby
-version: !ruby/object:Gem::Version
- version: 1.2.5
-platform: ruby
-authors:
-- Jamis Buck
-autorequire:
-bindir: bin
-cert_chain: []
-
-date: 2009-07-25 00:00:00 -03:00
-default_executable:
-dependencies:
-- !ruby/object:Gem::Dependency
- name: mocha
- type: :development
- version_requirement:
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-- !ruby/object:Gem::Dependency
- name: rake-compiler
- type: :development
- version_requirement:
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ~>
- - !ruby/object:Gem::Version
- version: 0.5.0
- version:
-- !ruby/object:Gem::Dependency
- name: hoe
- type: :development
- version_requirement:
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: 2.3.2
- version:
-description: |-
- This module allows Ruby programs to interface with the SQLite3
- database engine (http://www.sqlite.org). You must have the
- SQLite engine installed in order to build this module.
-
- Note that this module is NOT compatible with SQLite 2.x.
-email:
-- jamis@37signals.com
-executables: []
-
-extensions:
-- ext/sqlite3_api/extconf.rb
-extra_rdoc_files:
-- History.txt
-- Manifest.txt
-- README.txt
-files:
-- ChangeLog.cvs
-- History.txt
-- LICENSE
-- Manifest.txt
-- README.txt
-- Rakefile
-- ext/sqlite3_api/extconf.rb
-- ext/sqlite3_api/sqlite3_api.i
-- ext/sqlite3_api/sqlite3_api_wrap.c
-- faq/faq.rb
-- faq/faq.yml
-- lib/sqlite3.rb
-- lib/sqlite3/constants.rb
-- lib/sqlite3/database.rb
-- lib/sqlite3/driver/dl/api.rb
-- lib/sqlite3/driver/dl/driver.rb
-- lib/sqlite3/driver/native/driver.rb
-- lib/sqlite3/errors.rb
-- lib/sqlite3/pragmas.rb
-- lib/sqlite3/resultset.rb
-- lib/sqlite3/statement.rb
-- lib/sqlite3/translator.rb
-- lib/sqlite3/value.rb
-- lib/sqlite3/version.rb
-- setup.rb
-- tasks/benchmark.rake
-- tasks/faq.rake
-- tasks/gem.rake
-- tasks/native.rake
-- tasks/vendor_sqlite3.rake
-- test/bm.rb
-- test/driver/dl/tc_driver.rb
-- test/helper.rb
-- test/native-vs-dl.rb
-- test/test_database.rb
-- test/test_errors.rb
-- test/test_integration.rb
-- test/test_integration_open_close.rb
-- test/test_integration_pending.rb
-- test/test_integration_resultset.rb
-- test/test_integration_statement.rb
-has_rdoc: true
-homepage: http://sqlite3-ruby.rubyforge.org
-licenses: []
-
-post_install_message:
-rdoc_options:
-- --main
-- README.txt
-- --main=README.txt
-require_paths:
-- lib
-- ext
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">"
- - !ruby/object:Gem::Version
- version: 1.8.5
- version:
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-requirements: []
-
-rubyforge_project: sqlite-ruby
-rubygems_version: 1.3.5
-signing_key:
-specification_version: 3
-summary: This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)
-test_files:
-- test/test_database.rb
-- test/test_errors.rb
-- test/test_integration.rb
-- test/test_integration_open_close.rb
-- test/test_integration_pending.rb
-- test/test_integration_resultset.rb
-- test/test_integration_statement.rb
diff --git a/vendor/plugins/sqlite3-ruby/test/bm.rb b/vendor/plugins/sqlite3-ruby/test/bm.rb
deleted file mode 100644
index aacb4a12..00000000
--- a/vendor/plugins/sqlite3-ruby/test/bm.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-require 'benchmark'
-
-N = 1000
-
-$VERBOSE=nil
-
-puts "file require"
-Benchmark.bm( 7 ) do |x|
- x.report('sqlite') do
- N.times do
- $".delete_if { |i| i =~ /sqlite/ }
- require 'sqlite'
- end
- end
- x.report('sqlite3') do
- N.times do
- $".delete_if { |i| i =~ /sqlite3/ }
- require 'sqlite3'
- end
- end
-end
-
-puts
-puts "database creation..."
-Benchmark.bm( 7 ) do |x|
- x.report('sqlite') do
- N.times do
- File.delete "test.db" rescue nil
- SQLite::Database.open( "test.db" ).close
- end
- end
- x.report('sqlite3') do
- N.times do
- File.delete "test.db" rescue nil
- SQLite3::Database.open( "test.db" ).close
- end
- end
-end
-File.delete "test.db" rescue nil
-
-SQLite::Database.open( "test.db" ).close
-SQLite3::Database.open( "test3.db" ).close
-
-puts
-puts "database open..."
-Benchmark.bm( 7 ) do |x|
- x.report('sqlite') do
- N.times do
- SQLite::Database.open( "test.db" ).close
- end
- end
- x.report('sqlite3') do
- N.times do
- SQLite3::Database.open( "test3.db" ).close
- end
- end
-end
-File.delete "test.db" rescue nil
-File.delete "test3.db" rescue nil
-
-db = SQLite::Database.open( "test.db" )
-db3 = SQLite3::Database.open( "test3.db" )
-
-db.execute "create table foo (a,b)"
-db3.execute "create table foo (a,b)"
-
-puts
-puts "insertions"
-Benchmark.bm( 7 ) do |x|
- x.report('sqlite') do
- db.transaction do
- N.times do |i|
- db.execute "insert into foo values (#{i}, #{i+1})"
- end
- end
- end
- x.report('sqlite3') do
- db3.transaction do
- N.times do |i|
- db3.execute "insert into foo values (#{i}, #{i+1})"
- end
- end
- end
-end
-
-puts
-puts "insertions using prepared statement"
-Benchmark.bm( 7 ) do |x|
- x.report('sqlite') do
- db.transaction do
- stmt = db.prepare "insert into foo values (?,?)"
- N.times { |i| stmt.execute i, i+1 }
- end
- end
- x.report('sqlite3') do
- db3.transaction do
- db3.prepare( "insert into foo values (?,?)" ) do |stmt|
- N.times { |i| stmt.execute i, i+1 }
- end
- end
- end
-end
-
-db.close
-db3.close
-File.delete "test.db" rescue nil
-File.delete "test3.db" rescue nil
-
-db = SQLite::Database.open( "test.db" )
-db3 = SQLite3::Database.open( "test3.db" )
-
-db.execute "create table foo (a,b)"
-db.execute "insert into foo values (1,2)"
-db.execute "insert into foo values (3,4)"
-db.execute "insert into foo values (5,6)"
-
-db3.execute "create table foo (a,b)"
-db3.execute "insert into foo values (1,2)"
-db3.execute "insert into foo values (3,4)"
-db3.execute "insert into foo values (5,6)"
-
-puts
-puts "queries"
-Benchmark.bm( 7 ) do |x|
- x.report('sqlite') do
- N.times do
- db.execute "select * from foo"
- end
- end
- x.report('sqlite3') do
- N.times do
- db3.execute "select * from foo"
- end
- end
-end
-
-db.close
-db3.close
-File.delete "test.db" rescue nil
-File.delete "test3.db" rescue nil
diff --git a/vendor/plugins/sqlite3-ruby/test/driver/dl/tc_driver.rb b/vendor/plugins/sqlite3-ruby/test/driver/dl/tc_driver.rb
deleted file mode 100644
index b2cb2df4..00000000
--- a/vendor/plugins/sqlite3-ruby/test/driver/dl/tc_driver.rb
+++ /dev/null
@@ -1,292 +0,0 @@
-if (ENV["SQLITE3_DRIVERS"] || "Native").split(/,/).include?("DL")
- $:.unshift "../../../lib"
-
- require 'sqlite3/constants'
- require 'sqlite3/driver/dl/driver'
- require 'test/unit'
-
- class TC_DL_Driver < Test::Unit::TestCase
-
- def utf16ify( str )
- chars = str.split(//)
- chars.zip(["\0"] * chars.length).flatten.join
- end
-
- def setup
- @driver = SQLite3::Driver::DL::Driver.new
- @dbname = "test.db"
- @db = nil
- end
-
- def teardown
- @driver.close( @db ) rescue nil
- File.delete @dbname rescue nil
- end
-
- def test_open
- result, @db = @driver.open( @dbname )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert File.exist?( @dbname )
- end
-
- def test_open_utf16
- name = utf16ify( @dbname )
- result, @db = @driver.open( name, true )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert File.exist?( @dbname )
- end
-
- def test_errmsg
- result, @db = @driver.open( @dbname )
- msg = @driver.errmsg( @db )
- assert_equal msg, "not an error"
- end
-
- def test_errmsg16
- result, @db = @driver.open( @dbname )
- msg = @driver.errmsg( @db, true )
- assert_equal msg, utf16ify( "not an error" )
- end
-
- def test_prepare
- result, @db = @driver.open( @dbname )
- sql = "create table foo ( a, b )"
- result, handle, remainder = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert_equal "", remainder
- @driver.finalize( handle )
- end
-
- def test_prepare_error
- result, @db = @driver.open( @dbname )
- sql = "create tble foo ( a, b )"
- result, handle, remainder = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::ERROR, result
- end
-
- def test_prepare_remainder
- result, @db = @driver.open( @dbname )
- sql = "create table foo ( a, b ); select * from foo"
- result, handle, remainder = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert_equal " select * from foo", remainder
- @driver.finalize( handle )
- end
-
- def test_prepare16
- result, @db = @driver.open( @dbname )
- sql = utf16ify( "create table foo ( a, b )" )
- result, handle, remainder = @driver.prepare( @db, sql, true )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert_equal "", remainder
- @driver.finalize( handle )
- end
-
- def test_prepare16_remainder
- result, @db = @driver.open( @dbname )
- sql = utf16ify( "create table foo ( a, b ); select * from foo" )
- result, handle, remainder = @driver.prepare( @db, sql, true )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert_equal utf16ify( " select * from foo" ), remainder
- @driver.finalize( handle )
- end
-
- def test_complete
- assert @driver.complete?( "select * from foo;" )
- end
-
- def test_complete_fail
- assert !@driver.complete?( "select * from foo" )
- end
-
- def test_complete16
- assert @driver.complete?( utf16ify("select * from foo;"), true )
- end
-
- def create_foo
- result, @db = @driver.open( @dbname )
- sql = "create table foo ( a, b )"
- result, handle, = @driver.prepare( @db, sql )
- @driver.step( handle )
- @driver.finalize( handle )
- end
-
- def populate_foo
- create_foo
- sql = "insert into foo values ( 100, 200 )"
- result, handle, = @driver.prepare( @db, sql )
- @driver.step( handle )
- @driver.finalize( handle )
- end
-
- def test_step
- populate_foo
- sql = "select * from foo"
- result, handle, = @driver.prepare( @db, sql )
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- @driver.finalize( handle )
- end
-
- def test_step_fail
- populate_foo
- sql = "select * from"
- result, handle, = @driver.prepare( @db, sql )
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::MISUSE, result
- @driver.finalize( handle )
- end
-
- def test_bind_blob
- create_foo
- sql = "insert into foo (b) values (?)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_blob( handle, 1, "a\0b\1c\2d\0e" )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- sql = "select b from foo"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- assert_equal "a\0b\1c\2d\0e", @driver.column_blob( handle, 0 )
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- end
-
- def test_bind_double
- create_foo
- sql = "insert into foo (b) values (?)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_double( handle, 1, 3.14 )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- sql = "select b from foo"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- assert_equal 3.14, @driver.column_double( handle, 0 )
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- end
-
- def test_bind_int
- create_foo
- sql = "insert into foo (b) values (?)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_int( handle, 1, 14 )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- sql = "select b from foo"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- assert_equal 14, @driver.column_int( handle, 0 )
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- end
-
- def test_bind_null
- create_foo
- sql = "insert into foo (b) values (?)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_null( handle, 1 )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- sql = "select b from foo"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- assert_equal SQLite3::Constants::ColumnType::NULL,
- @driver.column_type( handle, 0 )
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- end
-
- def test_bind_text
- create_foo
- sql = "insert into foo (b) values (?)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_text( handle, 1, "hello, world" )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- sql = "select b from foo"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- assert_equal "hello, world", @driver.column_text( handle, 0 )
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- end
-
- def test_bind_text16
- create_foo
- sql = "insert into foo (b) values (?)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_text( handle, 1, utf16ify("hello, world"), true )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::DONE, result
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- sql = "select b from foo"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.step( handle )
- assert_equal SQLite3::Constants::ErrorCode::ROW, result
- assert_equal "hello, world", @driver.column_text( handle, 0 )
- result = @driver.finalize( handle )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- end
-
- def test_bind_parameter_index
- create_foo
- sql = "insert into foo (b) values (:hello)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- result = @driver.bind_parameter_index( handle, ":hello" )
- assert_equal 1, result
- result = @driver.bind_parameter_index( handle, ":foo" )
- assert_equal 0, result
- @driver.finalize( handle )
- end
-
- def test_bind_parameter_name
- create_foo
- sql = "insert into foo (a,b) values (?,:foo)"
- result, handle, = @driver.prepare( @db, sql )
- assert_equal SQLite3::Constants::ErrorCode::OK, result
- assert_nil nil, @driver.bind_parameter_name(handle,1)
- assert_equal ":foo", @driver.bind_parameter_name(handle,2)
- @driver.finalize( handle )
- end
-
- end
-end
\ No newline at end of file
diff --git a/vendor/plugins/sqlite3-ruby/test/helper.rb b/vendor/plugins/sqlite3-ruby/test/helper.rb
index 6d5aa90e..a61859e6 100644
--- a/vendor/plugins/sqlite3-ruby/test/helper.rb
+++ b/vendor/plugins/sqlite3-ruby/test/helper.rb
@@ -1,67 +1,3 @@
-# add lib folder to the path
-$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
-
require 'sqlite3'
-
-require 'rubygems'
require 'test/unit'
-
-# define mocks to be used
-require 'mocha'
-
-class Driver < Mocha::Mock
- def initialize
- super
- stubs( :open ).returns([0, 'cookie'])
- stubs( :close ).returns(0)
- stubs( :complete? ).returns(0)
- stubs( :errmsg ).returns('')
- stubs( :errcode ).returns(0)
- stubs( :trace ).returns(nil)
- stubs( :set_authorizer ).returns(0)
- stubs( :prepare ).returns([0, 'stmt', 'remainder'])
- stubs( :finalize ).returns(0)
- stubs( :changes ).returns(14)
- stubs( :total_changes ).returns(28)
- stubs( :interrupt ).returns(0)
- end
-end
-
-class MockResultSet < Mocha::Mock
- def initialize
- super
- stubs( :each ).yields(['foo'])
- stubs( :columns ).returns(['name'])
- end
-end
-
-class Statement < Mocha::Mock
- attr_reader :handle
- attr_reader :sql
- attr_reader :last_result
-
- def initialize( handle, sql )
- super()
- @handle = handle
- @sql = sql
- stubs( :close ).returns(0)
- stubs( :remainder ).returns('')
- stubs( :execute ).returns(MockResultSet.new)
- end
-end
-
-# UTF conversion extensions
-class String
- def to_utf16(terminate=false)
- self.split(//).map { |c| c[0] }.pack("v*") +
- (terminate ? "\0\0" : "")
- end
-
- def from_utf16
- result = ""
- length.times do |i|
- result << self[i,1] if i % 2 == 0 && self[i] != 0
- end
- result
- end
-end
+require 'iconv'
diff --git a/vendor/plugins/sqlite3-ruby/test/native-vs-dl.rb b/vendor/plugins/sqlite3-ruby/test/native-vs-dl.rb
deleted file mode 100644
index 45e7e28b..00000000
--- a/vendor/plugins/sqlite3-ruby/test/native-vs-dl.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-$:.unshift "../lib", "../ext/sqlite3_api"
-
-require 'sqlite3'
-
-require 'benchmark'
-
-N = 1000
-
-$VERBOSE=nil
-
-puts "database creation..."
-Benchmark.bm( 7 ) do |x|
- x.report('dl') do
- N.times do
- File.delete "test.db" rescue nil
- SQLite3::Database.open( "test.db", :driver => "DL" ).close
- end
- end
- x.report('native') do
- N.times do
- File.delete "test.db" rescue nil
- SQLite3::Database.open( "test.db", :driver => "Native" ).close
- end
- end
-end
-File.delete "test.db" rescue nil
-
-SQLite3::Database.open( "test.db" ).close
-
-puts
-puts "database open..."
-Benchmark.bm( 7 ) do |x|
- x.report('dl') do
- N.times do
- SQLite3::Database.open( "test.db", :driver => "DL" ).close
- end
- end
- x.report('native') do
- N.times do
- SQLite3::Database.open( "test.db", :driver => "Native" ).close
- end
- end
-end
-File.delete "test.db" rescue nil
-
-dl = SQLite3::Database.open( "test-dl.db", :driver => "DL" )
-native = SQLite3::Database.open( "test-native.db", :driver => "Native" )
-
-dl.execute "create table foo (a,b)"
-native.execute "create table foo (a,b)"
-
-puts
-puts "insertions"
-Benchmark.bm( 7 ) do |x|
- x.report('dl') do
- dl.transaction do
- N.times do |i|
- dl.execute "insert into foo values (#{i}, #{i+1})"
- end
- end
- end
- x.report('native') do
- native.transaction do
- N.times do |i|
- native.execute "insert into foo values (#{i}, #{i+1})"
- end
- end
- end
-end
-
-puts
-puts "insertions using prepared statement"
-Benchmark.bm( 7 ) do |x|
- x.report('dl') do
- dl.transaction do
- dl.prepare "insert into foo values (?,?)" do |stmt|
- N.times { |i| stmt.execute i, i+1 }
- end
- end
- end
- x.report('native') do
- native.transaction do
- native.prepare( "insert into foo values (?,?)" ) do |stmt|
- N.times { |i| stmt.execute i, i+1 }
- end
- end
- end
-end
-
-dl.close
-native.close
-File.delete "test-dl.db" rescue nil
-File.delete "test-native.db" rescue nil
-
-dl = SQLite3::Database.open( "test-dl.db", :driver => "DL" )
-native = SQLite3::Database.open( "test-native.db", :driver => "Native" )
-
-dl.execute "create table foo (a,b)"
-dl.execute "insert into foo values (1,2)"
-dl.execute "insert into foo values (3,4)"
-dl.execute "insert into foo values (5,6)"
-
-native.execute "create table foo (a,b)"
-native.execute "insert into foo values (1,2)"
-native.execute "insert into foo values (3,4)"
-native.execute "insert into foo values (5,6)"
-
-puts
-puts "queries"
-Benchmark.bm( 7 ) do |x|
- x.report('dl') do
- N.times do
- dl.execute "select * from foo"
- end
- end
- x.report('native') do
- N.times do
- native.execute "select * from foo"
- end
- end
-end
-
-dl.close
-native.close
-File.delete "test-dl.db" rescue nil
-File.delete "test-native.db" rescue nil
diff --git a/vendor/plugins/sqlite3-ruby/test/test_database.rb b/vendor/plugins/sqlite3-ruby/test/test_database.rb
index ca4d8e35..9c319a77 100644
--- a/vendor/plugins/sqlite3-ruby/test/test_database.rb
+++ b/vendor/plugins/sqlite3-ruby/test/test_database.rb
@@ -1,217 +1,291 @@
-require File.join(File.dirname(__FILE__), 'helper')
+require 'helper'
+require 'iconv'
-class TC_Database_Init < Test::Unit::TestCase
- def test_new
- # any_instance fails here...
- driver = Driver.new
- driver.expects(:open).once.with('foo.db', false).returns([0, 'cookie'])
- Driver.stubs(:new).returns(driver)
- db = SQLite3::Database.new( 'foo.db', :driver => Driver )
- assert !db.closed?
- assert !db.results_as_hash
- assert !db.type_translation
- end
-
- def test_new_with_block
- driver = Driver.new
- driver.expects(:open).once.with('foo.db', false).returns([0, 'cookie'])
- Driver.stubs(:new).returns(driver)
- returned_db = SQLite3::Database.new( "foo.db", :driver => Driver ) do |db|
- assert !db.closed?
- assert !db.results_as_hash
- assert !db.type_translation
+module SQLite3
+ class TestDatabase < Test::Unit::TestCase
+ def setup
+ @db = SQLite3::Database.new(':memory:')
end
- assert returned_db.closed?
- end
- def test_open
- driver = Driver.new
- driver.expects(:open).once.with('foo.db', false).returns([0, 'cookie'])
- Driver.stubs(:new).returns(driver)
- db = SQLite3::Database.open( "foo.db", :driver => Driver )
- assert !db.closed?
- assert !db.results_as_hash
- assert !db.type_translation
- end
-
- def test_open_with_block
- driver = Driver.new
- driver.expects(:open).once.with('foo.db', false).returns([0, 'cookie'])
- Driver.stubs(:new).returns(driver)
- returned_db = SQLite3::Database.open( "foo.db", :driver => Driver ) do |db|
- assert !db.closed?
- assert !db.results_as_hash
- assert !db.type_translation
+ def test_changes
+ @db.execute("CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT, number integer)")
+ assert_equal 0, @db.changes
+ @db.execute("INSERT INTO items (number) VALUES (10)")
+ assert_equal 1, @db.changes
+ @db.execute_batch(
+ "UPDATE items SET number = (number + :nn) WHERE (number = :n)",
+ {"nn" => 20, "n" => 10})
+ assert_equal 1, @db.changes
+ assert_equal [[30]], @db.execute("select number from items")
+ end
+
+ def test_new
+ db = SQLite3::Database.new(':memory:')
+ assert db
+ end
+
+ def test_new_yields_self
+ thing = nil
+ SQLite3::Database.new(':memory:') do |db|
+ thing = db
+ end
+ assert_instance_of(SQLite3::Database, thing)
+ end
+
+ def test_new_with_options
+ db = SQLite3::Database.new(Iconv.conv('UTF-16LE', 'UTF-8', ':memory:'),
+ :utf16 => true)
+ assert db
+ end
+
+ def test_close
+ db = SQLite3::Database.new(':memory:')
+ db.close
+ assert db.closed?
+ end
+
+ def test_block_closes_self
+ thing = nil
+ SQLite3::Database.new(':memory:') do |db|
+ thing = db
+ assert !thing.closed?
+ end
+ assert thing.closed?
+ end
+
+ def test_prepare
+ db = SQLite3::Database.new(':memory:')
+ stmt = db.prepare('select "hello world"')
+ assert_instance_of(SQLite3::Statement, stmt)
+ end
+
+ def test_total_changes
+ db = SQLite3::Database.new(':memory:')
+ db.execute("create table foo ( a integer primary key, b text )")
+ db.execute("insert into foo (b) values ('hello')")
+ assert_equal 1, db.total_changes
+ end
+
+ def test_execute_returns_list_of_hash
+ db = SQLite3::Database.new(':memory:', :results_as_hash => true)
+ db.execute("create table foo ( a integer primary key, b text )")
+ db.execute("insert into foo (b) values ('hello')")
+ rows = db.execute("select * from foo")
+ assert_equal [{0=>1, "a"=>1, "b"=>"hello", 1=>"hello"}], rows
+ end
+
+ def test_execute_yields_hash
+ db = SQLite3::Database.new(':memory:', :results_as_hash => true)
+ db.execute("create table foo ( a integer primary key, b text )")
+ db.execute("insert into foo (b) values ('hello')")
+ db.execute("select * from foo") do |row|
+ assert_equal({0=>1, "a"=>1, "b"=>"hello", 1=>"hello"}, row)
+ end
+ end
+
+ def test_table_info
+ db = SQLite3::Database.new(':memory:', :results_as_hash => true)
+ db.execute("create table foo ( a integer primary key, b text )")
+ info = [{
+ "name" => "a",
+ "pk" => 1,
+ "notnull" => 0,
+ "type" => "integer",
+ "dflt_value" => nil,
+ "cid" => 0
+ },
+ {
+ "name" => "b",
+ "pk" => 0,
+ "notnull" => 0,
+ "type" => "text",
+ "dflt_value" => nil,
+ "cid" => 1
+ }]
+ assert_equal info, db.table_info('foo')
+ end
+
+ def test_total_changes_closed
+ db = SQLite3::Database.new(':memory:')
+ db.close
+ assert_raise(SQLite3::Exception) do
+ db.total_changes
+ end
+ end
+
+ def test_trace_requires_opendb
+ @db.close
+ assert_raise(SQLite3::Exception) do
+ @db.trace { |x| }
+ end
+ end
+
+ def test_trace_with_block
+ result = nil
+ @db.trace { |sql| result = sql }
+ @db.execute "select 'foo'"
+ assert_equal "select 'foo'", result
+ end
+
+ def test_trace_with_object
+ obj = Class.new {
+ attr_accessor :result
+ def call sql; @result = sql end
+ }.new
+
+ @db.trace(obj)
+ @db.execute "select 'foo'"
+ assert_equal "select 'foo'", obj.result
+ end
+
+ def test_trace_takes_nil
+ @db.trace(nil)
+ @db.execute "select 'foo'"
+ end
+
+ def test_last_insert_row_id_closed
+ @db.close
+ assert_raise(SQLite3::Exception) do
+ @db.last_insert_row_id
+ end
+ end
+
+ def test_define_function
+ called_with = nil
+ @db.define_function("hello") do |value|
+ called_with = value
+ end
+ @db.execute("select hello(10)")
+ assert_equal 10, called_with
+ end
+
+ def test_call_func_arg_type
+ called_with = nil
+ @db.define_function("hello") do |b, c, d|
+ called_with = [b, c, d]
+ nil
+ end
+ @db.execute("select hello(2.2, 'foo', NULL)")
+ assert_equal [2.2, 'foo', nil], called_with
+ end
+
+ def test_define_varargs
+ called_with = nil
+ @db.define_function("hello") do |*args|
+ called_with = args
+ nil
+ end
+ @db.execute("select hello(2.2, 'foo', NULL)")
+ assert_equal [2.2, 'foo', nil], called_with
+ end
+
+ def test_function_return
+ @db.define_function("hello") { |a| 10 }
+ assert_equal [10], @db.execute("select hello('world')").first
+ end
+
+ def test_function_return_types
+ [10, 2.2, nil, "foo"].each do |thing|
+ @db.define_function("hello") { |a| thing }
+ assert_equal [thing], @db.execute("select hello('world')").first
+ end
+ end
+
+ def test_define_function_closed
+ @db.close
+ assert_raise(SQLite3::Exception) do
+ @db.define_function('foo') { }
+ end
+ end
+
+ def test_inerrupt_closed
+ @db.close
+ assert_raise(SQLite3::Exception) do
+ @db.interrupt
+ end
+ end
+
+ def test_define_aggregate
+ @db.execute "create table foo ( a integer primary key, b text )"
+ @db.execute "insert into foo ( b ) values ( 'foo' )"
+ @db.execute "insert into foo ( b ) values ( 'bar' )"
+ @db.execute "insert into foo ( b ) values ( 'baz' )"
+
+ acc = Class.new {
+ attr_reader :sum
+ alias :finalize :sum
+ def initialize
+ @sum = 0
+ end
+
+ def step a
+ @sum += a
+ end
+ }.new
+
+ @db.define_aggregator("accumulate", acc)
+ value = @db.get_first_value( "select accumulate(a) from foo" )
+ assert_equal 6, value
+ end
+
+ def test_authorizer_ok
+ @db.authorizer = Class.new {
+ def call action, a, b, c, d; true end
+ }.new
+ @db.prepare("select 'fooooo'")
+
+ @db.authorizer = Class.new {
+ def call action, a, b, c, d; 0 end
+ }.new
+ @db.prepare("select 'fooooo'")
+ end
+
+ def test_authorizer_ignore
+ @db.authorizer = Class.new {
+ def call action, a, b, c, d; nil end
+ }.new
+ stmt = @db.prepare("select 'fooooo'")
+ assert_equal nil, stmt.step
+ end
+
+ def test_authorizer_fail
+ @db.authorizer = Class.new {
+ def call action, a, b, c, d; false end
+ }.new
+ assert_raises(SQLite3::AuthorizationException) do
+ @db.prepare("select 'fooooo'")
+ end
+ end
+
+ def test_remove_auth
+ @db.authorizer = Class.new {
+ def call action, a, b, c, d; false end
+ }.new
+ assert_raises(SQLite3::AuthorizationException) do
+ @db.prepare("select 'fooooo'")
+ end
+
+ @db.authorizer = nil
+ @db.prepare("select 'fooooo'")
+ end
+
+ def test_close_with_open_statements
+ stmt = @db.prepare("select 'foo'")
+ assert_raises(SQLite3::BusyException) do
+ @db.close
+ end
+ end
+
+ def test_execute_with_empty_bind_params
+ assert_equal [['foo']], @db.execute("select 'foo'", [])
+ end
+
+ def test_query_with_named_bind_params
+ assert_equal [['foo']], @db.query("select :n", {'n' => 'foo'}).to_a
+ end
+
+ def test_execute_with_named_bind_params
+ assert_equal [['foo']], @db.execute("select :n", {'n' => 'foo'})
end
- assert returned_db.closed?
- end
-
- def test_with_type_translation
- db = SQLite3::Database.open( "foo.db", :driver => Driver,
- :type_translation => true )
- assert db.type_translation
- end
-
- def test_with_results_as_hash
- db = SQLite3::Database.open( "foo.db", :driver => Driver,
- :results_as_hash => true )
- assert db.results_as_hash
- end
-
- def test_with_type_translation_and_results_as_hash
- db = SQLite3::Database.open( "foo.db", :driver => Driver,
- :results_as_hash => true,
- :type_translation => true )
- assert db.results_as_hash
- assert db.type_translation
- end
-end
-
-class TC_Database < Test::Unit::TestCase
- def setup
- @db = SQLite3::Database.open( "foo.db",
- :driver => Driver, :statement_factory => Statement )
- end
-
- def test_quote
- assert_equal "''one''two''three''", SQLite3::Database.quote(
- "'one'two'three'" )
- end
-
- def test_complete
- Driver.any_instance.expects(:complete?)
- @db.complete? "foo"
- end
-
- def test_errmsg
- Driver.any_instance.expects(:errmsg)
- @db.errmsg
- end
-
- def test_errcode
- Driver.any_instance.expects(:errcode)
- @db.errcode
- end
-
- def test_translator
- translator = @db.translator
- assert_instance_of SQLite3::Translator, translator
- end
-
- def test_close
- Driver.any_instance.expects(:close).returns(0)
- @db.close
- assert @db.closed?
- Driver.any_instance.expects(:close).never
- @db.close
- end
-
- def test_trace
- Driver.any_instance.expects(:trace).with('cookie', 15)
- @db.trace( 15 ) { "foo" }
- # assert_equal 1, driver.mock_blocks[:trace].length
- end
-
- def test_authorizer
- Driver.any_instance.expects(:set_authorizer).with('cookie', 15).returns(0)
- @db.authorizer( 15 ) { "foo" }
- # assert_equal 1, driver.mock_blocks[:set_authorizer].length
- end
-
- def test_prepare_no_block
- Statement.any_instance.expects(:close).never
- assert_nothing_raised { @db.prepare( "foo" ) }
- end
-
- def test_prepare_with_block
- called = false
- # any_instance fails here...
- statement = Statement.new('cookie', 'foo')
- statement.expects(:close).once
- Statement.stubs(:new).returns(statement)
- @db.prepare( "foo" ) { |stmt| called = true }
- assert called
- end
-
- def test_execute_no_block
- # any_instance fails here...
- statement = Statement.new('cookie', 'foo')
- statement.expects(:execute).with('bar', 'baz').returns(MockResultSet.new)
- Statement.stubs(:new).returns(statement)
- MockResultSet.any_instance.stubs(:inject).returns([['foo']])
- result = @db.execute( "foo", "bar", "baz" )
- assert_equal [["foo"]], result
- end
-
- def test_execute_with_block
- called = false
- # any_instance fails here...
- statement = Statement.new('cookie', 'foo')
- statement.expects(:execute).with('bar', 'baz').returns(MockResultSet.new)
- Statement.stubs(:new).returns(statement)
- @db.execute( "foo", "bar", "baz" ) do |row|
- called = true
- assert_equal ["foo"], row
- end
-
- assert called
- end
-
- def test_execute2_no_block
- # any_instance fails here...
- statement = Statement.new('cookie', 'foo')
- statement.expects(:execute).with('bar', 'baz').returns(MockResultSet.new)
- Statement.stubs(:new).returns(statement)
- MockResultSet.any_instance.stubs(:inject).returns([['name'], ['foo']])
- result = @db.execute2( "foo", "bar", "baz" )
- assert_equal [["name"],["foo"]], result
- end
-
- def test_execute2_with_block
- called = false
- parts = [ ["name"],["foo"] ]
- # any_instance fails here...
- statement = Statement.new('cookie', 'foo')
- statement.expects(:execute).with('bar', 'baz').returns(MockResultSet.new)
- Statement.stubs(:new).returns(statement)
- @db.execute2( "foo", "bar", "baz" ) do |row|
- called = true
- assert_equal parts.shift, row
- end
-
- assert called
- end
-
- def test_execute_batch
- # any_instance fails here...
- statement = Statement.new('cookie', 'foo')
- statement.expects(:execute).with('bar', 'baz').returns(MockResultSet.new)
- Statement.stubs(:new).returns(statement)
- @db.execute_batch( "foo", "bar", "baz" )
- end
-
- def test_get_first_row
- result = @db.get_first_row( "foo", "bar", "baz" )
- assert_equal ["foo"], result
- end
-
- def test_get_first_value
- result = @db.get_first_value( "foo", "bar", "baz" )
- assert_equal "foo", result
- end
-
- def test_changes
- Driver.any_instance.expects(:changes).returns(14)
- assert_equal 14, @db.changes
- end
-
- def test_total_changes
- Driver.any_instance.expects(:total_changes).returns(28)
- assert_equal 28, @db.total_changes
- end
-
- def test_interrupt
- Driver.any_instance.expects(:interrupt)
- @db.interrupt
end
end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_deprecated.rb b/vendor/plugins/sqlite3-ruby/test/test_deprecated.rb
new file mode 100644
index 00000000..eecef630
--- /dev/null
+++ b/vendor/plugins/sqlite3-ruby/test/test_deprecated.rb
@@ -0,0 +1,25 @@
+require 'helper'
+
+module SQLite3
+ class TestDeprecated < Test::Unit::TestCase
+ def setup
+ @db = SQLite3::Database.new(':memory:')
+ end
+
+ def test_query_with_many_bind_params
+ assert_equal [[nil, 1]], @db.query("select ?, ?", nil, 1).to_a
+ end
+
+ def test_query_with_nil_bind_params
+ assert_equal [['foo']], @db.query("select 'foo'", nil).to_a
+ end
+
+ def test_execute_with_many_bind_params
+ assert_equal [[nil, 1]], @db.execute("select ?, ?", nil, 1)
+ end
+
+ def test_execute_with_nil_bind_params
+ assert_equal [['foo']], @db.execute("select 'foo'", nil)
+ end
+ end
+end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_encoding.rb b/vendor/plugins/sqlite3-ruby/test/test_encoding.rb
new file mode 100644
index 00000000..9e28438c
--- /dev/null
+++ b/vendor/plugins/sqlite3-ruby/test/test_encoding.rb
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+
+require 'helper'
+
+module SQLite3
+ class TestEncoding < Test::Unit::TestCase
+ def setup
+ @db = SQLite3::Database.new(':memory:')
+ @create = "create table ex(id int, data string)"
+ @insert = "insert into ex(id, data) values (?, ?)"
+ @db.execute(@create);
+ end
+
+ def test_default_internal_is_honored
+ before_enc = Encoding.default_internal
+
+ str = "壁に耳あり、障子に目あり"
+ stmt = @db.prepare('insert into ex(data) values (?)')
+ stmt.bind_param 1, str
+ stmt.step
+
+ Encoding.default_internal = 'EUC-JP'
+ string = @db.execute('select data from ex').first.first
+
+ assert_equal Encoding.default_internal, string.encoding
+ assert_equal str.encode('EUC-JP'), string
+ assert_equal str, string.encode(str.encoding)
+ ensure
+ Encoding.default_internal = before_enc
+ end
+
+ def test_blob_is_binary
+ str = "猫舌"
+ @db.execute('create table foo(data text)')
+ stmt = @db.prepare('insert into foo(data) values (?)')
+ stmt.bind_param(1, SQLite3::Blob.new(str))
+ stmt.step
+
+ string = @db.execute('select data from foo').first.first
+ assert_equal Encoding.find('ASCII-8BIT'), string.encoding
+ assert_equal str, string.force_encoding('UTF-8')
+ end
+
+ def test_blob_is_ascii8bit
+ str = "猫舌"
+ @db.execute('create table foo(data text)')
+ stmt = @db.prepare('insert into foo(data) values (?)')
+ stmt.bind_param(1, str.dup.force_encoding("ASCII-8BIT"))
+ stmt.step
+
+ string = @db.execute('select data from foo').first.first
+ assert_equal Encoding.find('ASCII-8BIT'), string.encoding
+ assert_equal str, string.force_encoding('UTF-8')
+ end
+
+ def test_blob_with_eucjp
+ str = "猫舌".encode("EUC-JP")
+ @db.execute('create table foo(data text)')
+ stmt = @db.prepare('insert into foo(data) values (?)')
+ stmt.bind_param(1, SQLite3::Blob.new(str))
+ stmt.step
+
+ string = @db.execute('select data from foo').first.first
+ assert_equal Encoding.find('ASCII-8BIT'), string.encoding
+ assert_equal str, string.force_encoding('EUC-JP')
+ end
+
+ def test_db_with_eucjp
+ db = SQLite3::Database.new(':memory:'.encode('EUC-JP'))
+ assert_equal(Encoding.find('UTF-8'), db.encoding)
+ end
+
+ def test_db_with_utf16
+ db = SQLite3::Database.new(':memory:'.encode('UTF-16LE'))
+ assert_equal(Encoding.find('UTF-16LE'), db.encoding)
+ end
+
+ def test_statement_eucjp
+ str = "猫舌"
+ @db.execute("insert into ex(data) values ('#{str}')".encode('EUC-JP'))
+ row = @db.execute("select data from ex")
+ assert_equal @db.encoding, row.first.first.encoding
+ assert_equal str, row.first.first
+ end
+
+ def test_statement_utf8
+ str = "猫舌"
+ @db.execute("insert into ex(data) values ('#{str}')")
+ row = @db.execute("select data from ex")
+ assert_equal @db.encoding, row.first.first.encoding
+ assert_equal str, row.first.first
+ end
+
+ def test_encoding
+ assert_equal Encoding.find("UTF-8"), @db.encoding
+ end
+
+ def test_utf_8
+ str = "猫舌"
+ @db.execute(@insert, 10, str)
+ row = @db.execute("select data from ex")
+ assert_equal @db.encoding, row.first.first.encoding
+ assert_equal str, row.first.first
+ end
+
+ def test_euc_jp
+ str = "猫舌".encode('EUC-JP')
+ @db.execute(@insert, 10, str)
+ row = @db.execute("select data from ex")
+ assert_equal @db.encoding, row.first.first.encoding
+ assert_equal str.encode('UTF-8'), row.first.first
+ end
+
+ end if RUBY_VERSION >= '1.9.1'
+end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_errors.rb b/vendor/plugins/sqlite3-ruby/test/test_errors.rb
deleted file mode 100644
index 132fbc90..00000000
--- a/vendor/plugins/sqlite3-ruby/test/test_errors.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require File.join(File.dirname(__FILE__), 'helper')
-
-class TC_Errors < Test::Unit::TestCase
- (1..26).each do |code|
- define_method( "test_error_code_%02d" % code ) do
- db = stub('database', :errmsg => 'message')
- begin
- SQLite3::Error.check( code, db )
- rescue SQLite3::Exception => e
- assert_instance_of SQLite3::EXCEPTIONS[code], e
- assert_equal code, e.code
- assert_equal code, e.class.code
- assert_equal "message", e.message
- end
- end
- end
-end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_integration.rb b/vendor/plugins/sqlite3-ruby/test/test_integration.rb
index 314a7118..2721c8dd 100644
--- a/vendor/plugins/sqlite3-ruby/test/test_integration.rb
+++ b/vendor/plugins/sqlite3-ruby/test/test_integration.rb
@@ -1,8 +1,8 @@
-require File.join(File.dirname(__FILE__), 'helper')
+require 'helper'
class TC_Database_Integration < Test::Unit::TestCase
def setup
- @db = SQLite3::Database.new( "test.db" )
+ @db = SQLite3::Database.new(":memory:")
@db.transaction do
@db.execute "create table foo ( a integer primary key, b text )"
@db.execute "insert into foo ( b ) values ( 'foo' )"
@@ -13,7 +13,6 @@ class TC_Database_Integration < Test::Unit::TestCase
def teardown
@db.close
- File.delete( "test.db" )
end
def test_table_info_with_type_translation_active
@@ -25,9 +24,9 @@ class TC_Database_Integration < Test::Unit::TestCase
@db.transaction do
@db.execute "create table defaults_test ( a string default NULL, b string default 'Hello' )"
data = @db.table_info( "defaults_test" )
- assert_equal({"name" => "a", "type" => "string", "dflt_value" => nil, "notnull" => "0", "cid" => "0", "pk" => "0"},
+ assert_equal({"name" => "a", "type" => "string", "dflt_value" => nil, "notnull" => 0, "cid" => 0, "pk" => 0},
data[0])
- assert_equal({"name" => "b", "type" => "string", "dflt_value" => "Hello", "notnull" => "0", "cid" => "1", "pk" => "0"},
+ assert_equal({"name" => "b", "type" => "string", "dflt_value" => "Hello", "notnull" => 0, "cid" => 1, "pk" => 0},
data[1])
end
end
@@ -36,9 +35,9 @@ class TC_Database_Integration < Test::Unit::TestCase
@db.transaction do
@db.execute "create table no_defaults_test ( a integer default 1, b integer )"
data = @db.table_info( "no_defaults_test" )
- assert_equal({"name" => "a", "type" => "integer", "dflt_value" => "1", "notnull" => "0", "cid" => "0", "pk" => "0"},
+ assert_equal({"name" => "a", "type" => "integer", "dflt_value" => "1", "notnull" => 0, "cid" => 0, "pk" => 0},
data[0])
- assert_equal({"name" => "b", "type" => "integer", "dflt_value" => nil, "notnull" => "0", "cid" => "1", "pk" => "0"},
+ assert_equal({"name" => "b", "type" => "integer", "dflt_value" => nil, "notnull" => 0, "cid" => 1, "pk" => 0},
data[1])
end
end
@@ -50,21 +49,25 @@ class TC_Database_Integration < Test::Unit::TestCase
assert @db.complete?( "select * from foo;" )
end
- def test_complete_fail_utf16
- assert !@db.complete?( "select * from foo".to_utf16(false), true )
- end
+ # FIXME: do people really need UTF16 sql statements?
+ #def test_complete_fail_utf16
+ # assert !@db.complete?( "select * from foo".to_utf16(false), true )
+ #end
- def test_complete_success_utf16
- assert @db.complete?( "select * from foo;".to_utf16(true), true )
- end
+ # FIXME: do people really need UTF16 sql statements?
+ #def test_complete_success_utf16
+ # assert @db.complete?( "select * from foo;".to_utf16(true), true )
+ #end
def test_errmsg
assert_equal "not an error", @db.errmsg
end
- def test_errmsg_utf16
- assert_equal "not an error".to_utf16, @db.errmsg(true)
- end
+ # FIXME: do people really need UTF16 error messages?
+ #def test_errmsg_utf16
+ # msg = Iconv.conv('UTF-16', 'UTF-8', 'not an error')
+ # assert_equal msg, @db.errmsg(true)
+ #end
def test_errcode
assert_equal 0, @db.errcode
@@ -72,26 +75,26 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_trace
result = nil
- @db.trace( "data" ) { |data,sql| result = [ data, sql ]; 0 }
+ @db.trace { |sql| result = sql }
@db.execute "select * from foo"
- assert_equal ["data","select * from foo"], result
+ assert_equal "select * from foo", result
end
def test_authorizer_okay
- @db.authorizer( "data" ) { |data,type,a,b,c,d| 0 }
+ @db.authorizer { |type,a,b,c,d| 0 }
rows = @db.execute "select * from foo"
assert_equal 3, rows.length
end
def test_authorizer_error
- @db.authorizer( "data" ) { |data,type,a,b,c,d| 1 }
+ @db.authorizer { |type,a,b,c,d| 1 }
assert_raise( SQLite3::AuthorizationException ) do
@db.execute "select * from foo"
end
end
def test_authorizer_silent
- @db.authorizer( "data" ) { |data,type,a,b,c,d| 2 }
+ @db.authorizer { |type,a,b,c,d| 2 }
rows = @db.execute "select * from foo"
assert rows.empty?
end
@@ -184,7 +187,7 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_execute2_no_block_no_bind_no_match
columns, *rows = @db.execute2( "select * from foo where a > 100" )
assert rows.empty?
- assert [ "a", "b" ], columns
+ assert_equal [ "a", "b" ], columns
end
def test_execute2_with_block_no_bind_no_match
@@ -199,13 +202,13 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_execute2_no_block_with_bind_no_match
columns, *rows = @db.execute2( "select * from foo where a > ?", 100 )
assert rows.empty?
- assert [ "a", "b" ], columns
+ assert_equal [ "a", "b" ], columns
end
def test_execute2_with_block_with_bind_no_match
called = 0
@db.execute2( "select * from foo where a > ?", 100 ) do |row|
- assert [ "a", "b" ], row unless called == 0
+ assert_equal [ "a", "b" ], row unless called == 0
called += 1
end
assert_equal 1, called
@@ -214,13 +217,13 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_execute2_no_block_no_bind_with_match
columns, *rows = @db.execute2( "select * from foo where a = 1" )
assert_equal 1, rows.length
- assert [ "a", "b" ], columns
+ assert_equal [ "a", "b" ], columns
end
def test_execute2_with_block_no_bind_with_match
called = 0
@db.execute2( "select * from foo where a = 1" ) do |row|
- assert [ "a", "b" ], row unless called == 0
+ assert_equal [ 1, "foo" ], row unless called == 0
called += 1
end
assert_equal 2, called
@@ -229,7 +232,7 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_execute2_no_block_with_bind_with_match
columns, *rows = @db.execute2( "select * from foo where a = ?", 1 )
assert_equal 1, rows.length
- assert [ "a", "b" ], columns
+ assert_equal [ "a", "b" ], columns
end
def test_execute2_with_block_with_bind_with_match
@@ -265,7 +268,7 @@ class TC_Database_Integration < Test::Unit::TestCase
insert into bar values ( 'seven', 8, ? );
SQL
rows = @db.execute( "select * from bar" ).map { |a,b,c| c }
- assert_equal %w{1 1 1}, rows
+ assert_equal [1, 1, 1], rows
end
def test_query_no_block_no_bind_no_match
@@ -339,7 +342,7 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_get_first_row_no_bind_with_match
result = @db.get_first_row( "select * from foo where a=1" )
- assert_equal [ "1", "foo" ], result
+ assert_equal [ 1, "foo" ], result
end
def test_get_first_row_with_bind_no_match
@@ -349,7 +352,7 @@ class TC_Database_Integration < Test::Unit::TestCase
def test_get_first_row_with_bind_with_match
result = @db.get_first_row( "select * from foo where a=?", 1 )
- assert_equal [ "1", "foo" ], result
+ assert_equal [ 1, "foo" ], result
end
def test_get_first_value_no_bind_no_match
@@ -458,7 +461,7 @@ class TC_Database_Integration < Test::Unit::TestCase
func.result = x
end
- assert_raise( SQLite3::SQLException ) do
+ assert_raise( SQLite3::InterruptException ) do
@db.execute "select abort(a) from foo"
end
end
@@ -483,7 +486,7 @@ class TC_Database_Integration < Test::Unit::TestCase
@db.create_aggregate( "accumulate", 1, step, final )
value = @db.get_first_value( "select accumulate(a) from foo" )
- assert_equal "6", value
+ assert_equal 6, value
end
def test_create_aggregate_with_block
@@ -497,7 +500,7 @@ class TC_Database_Integration < Test::Unit::TestCase
end
value = @db.get_first_value( "select accumulate(a) from foo" )
- assert_equal "6", value
+ assert_equal 6, value
end
def test_create_aggregate_with_no_data
@@ -512,7 +515,7 @@ class TC_Database_Integration < Test::Unit::TestCase
value = @db.get_first_value(
"select accumulate(a) from foo where a = 100" )
- assert_equal "0", value
+ assert_equal 0, value
end
def test_create_aggregate_handler
@@ -531,7 +534,7 @@ class TC_Database_Integration < Test::Unit::TestCase
@db.create_aggregate_handler( handler )
value = @db.get_first_value( "select multiply(a) from foo" )
- assert_equal "6", value
+ assert_equal 6, value
end
def test_bind_array_parameter
diff --git a/vendor/plugins/sqlite3-ruby/test/test_integration_open_close.rb b/vendor/plugins/sqlite3-ruby/test/test_integration_open_close.rb
index 14185229..357dcc26 100644
--- a/vendor/plugins/sqlite3-ruby/test/test_integration_open_close.rb
+++ b/vendor/plugins/sqlite3-ruby/test/test_integration_open_close.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), 'helper')
+require 'helper'
class TC_OpenClose < Test::Unit::TestCase
def test_create_close
diff --git a/vendor/plugins/sqlite3-ruby/test/test_integration_pending.rb b/vendor/plugins/sqlite3-ruby/test/test_integration_pending.rb
index 06357ea4..cb4bea68 100644
--- a/vendor/plugins/sqlite3-ruby/test/test_integration_pending.rb
+++ b/vendor/plugins/sqlite3-ruby/test/test_integration_pending.rb
@@ -1,11 +1,11 @@
-require File.join(File.dirname(__FILE__), 'helper')
+require 'helper'
require 'thread'
require 'benchmark'
class TC_Integration_Pending < Test::Unit::TestCase
def setup
- @db = SQLite3::Database.new( "test.db" )
+ @db = SQLite3::Database.new("test.db")
@db.transaction do
@db.execute "create table foo ( a integer primary key, b text )"
@db.execute "insert into foo ( b ) values ( 'foo' )"
@@ -65,8 +65,9 @@ class TC_Integration_Pending < Test::Unit::TestCase
db2.close if db2
end
end
+ sleep 1
- @db.busy_handler do |data, count|
+ @db.busy_handler do |count|
handler_call_count += 1
false
end
@@ -97,6 +98,7 @@ class TC_Integration_Pending < Test::Unit::TestCase
end
end
+ sleep 1
time = Benchmark.measure do
assert_raise( SQLite3::BusyException ) do
@db.execute "insert into foo (b) values ( 'from 2' )"
@@ -108,4 +110,4 @@ class TC_Integration_Pending < Test::Unit::TestCase
assert time.real*1000 >= 1000
end
-end
\ No newline at end of file
+end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_integration_resultset.rb b/vendor/plugins/sqlite3-ruby/test/test_integration_resultset.rb
index aee998b4..5274fc90 100644
--- a/vendor/plugins/sqlite3-ruby/test/test_integration_resultset.rb
+++ b/vendor/plugins/sqlite3-ruby/test/test_integration_resultset.rb
@@ -1,8 +1,8 @@
-require File.join(File.dirname(__FILE__), 'helper')
+require 'helper'
class TC_ResultSet < Test::Unit::TestCase
def setup
- @db = SQLite3::Database.new( "test.db" )
+ @db = SQLite3::Database.new(":memory:")
@db.transaction do
@db.execute "create table foo ( a integer primary key, b text )"
@db.execute "insert into foo ( b ) values ( 'foo' )"
@@ -16,7 +16,6 @@ class TC_ResultSet < Test::Unit::TestCase
def teardown
@stmt.close
@db.close
- File.delete( "test.db" )
end
def test_reset_unused
@@ -56,7 +55,7 @@ class TC_ResultSet < Test::Unit::TestCase
def test_next_no_type_translation_no_hash
@result.reset( 1 )
- assert_equal [ "1", "foo" ], @result.next
+ assert_equal [ 1, "foo" ], @result.next
end
def test_next_type_translation
@@ -68,10 +67,22 @@ class TC_ResultSet < Test::Unit::TestCase
def test_next_type_translation_with_untyped_column
@db.type_translation = true
@db.query( "select count(*) from foo" ) do |result|
- assert_equal ["3"], result.next
+ assert_equal [3], result.next
end
end
+ def test_type_translation_execute
+ @db.type_translation = true
+ @db.execute "create table bar ( a integer, b america )"
+ @db.execute "insert into bar (a, b) values (NULL, '1974-07-25 14:39:00')"
+
+ @db.translator.add_translator('america') do |type, thing|
+ 'america'
+ end
+
+ assert_equal [[nil, 'america']], @db.execute("select * from bar")
+ end
+
def test_type_translation_with_null_column
@db.type_translation = true
@db.execute "create table bar ( a integer, b time, c string )"
@@ -98,10 +109,23 @@ class TC_ResultSet < Test::Unit::TestCase
end
end
+ def test_real_translation
+ @db.type_translation = true
+ @db.execute('create table foo_real(a real)')
+ @db.execute('insert into foo_real values (42)' )
+ @db.query('select a, sum(a), typeof(a), typeof(sum(a)) from foo_real') do |result|
+ result = result.next
+ assert result[0].is_a?(Float)
+ assert result[1].is_a?(Float)
+ assert result[2].is_a?(String)
+ assert result[3].is_a?(String)
+ end
+ end
+
def test_next_results_as_hash
@db.results_as_hash = true
@result.reset( 1 )
- assert_equal( { "a" => "1", "b" => "foo", 0 => "1", 1 => "foo" },
+ assert_equal( { "a" => 1, "b" => "foo", 0 => 1, 1 => "foo" },
@result.next )
end
@@ -110,7 +134,7 @@ class TC_ResultSet < Test::Unit::TestCase
@result.reset( 1 )
row = @result.next
row.each do |_, v|
- assert_equal true, v.tainted?
+ assert(v.tainted?) if String === v
end
end
@@ -118,7 +142,7 @@ class TC_ResultSet < Test::Unit::TestCase
@result.reset( 1 )
row = @result.next
row.each do |v|
- assert_equal true, v.tainted?
+ assert(v.tainted?) if String === v
end
end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_integration_statement.rb b/vendor/plugins/sqlite3-ruby/test/test_integration_statement.rb
index 926d510f..9f7cde54 100644
--- a/vendor/plugins/sqlite3-ruby/test/test_integration_statement.rb
+++ b/vendor/plugins/sqlite3-ruby/test/test_integration_statement.rb
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), 'helper')
class TC_Statement < Test::Unit::TestCase
def setup
- @db = SQLite3::Database.new( "test.db" )
+ @db = SQLite3::Database.new(":memory:")
@db.transaction do
@db.execute "create table foo ( a integer primary key, b text )"
@db.execute "insert into foo ( b ) values ( 'foo' )"
@@ -15,7 +15,6 @@ class TC_Statement < Test::Unit::TestCase
def teardown
@stmt.close
@db.close
- File.delete( "test.db" )
end
def test_remainder_empty
diff --git a/vendor/plugins/sqlite3-ruby/test/test_sqlite3.rb b/vendor/plugins/sqlite3-ruby/test/test_sqlite3.rb
new file mode 100644
index 00000000..d28ef64a
--- /dev/null
+++ b/vendor/plugins/sqlite3-ruby/test/test_sqlite3.rb
@@ -0,0 +1,9 @@
+require 'helper'
+
+module SQLite3
+ class TestSQLite3 < Test::Unit::TestCase
+ def test_libversion
+ assert_not_nil SQLite3.libversion
+ end
+ end
+end
diff --git a/vendor/plugins/sqlite3-ruby/test/test_statement.rb b/vendor/plugins/sqlite3-ruby/test/test_statement.rb
new file mode 100644
index 00000000..fa1f3ffa
--- /dev/null
+++ b/vendor/plugins/sqlite3-ruby/test/test_statement.rb
@@ -0,0 +1,207 @@
+require 'helper'
+
+module SQLite3
+ class TestStatement < Test::Unit::TestCase
+ def setup
+ @db = SQLite3::Database.new(':memory:')
+ @stmt = SQLite3::Statement.new(@db, "select 'foo'")
+ end
+
+ ###
+ # This method may not exist depending on how sqlite3 was compiled
+ def test_database_name
+ @db.execute('create table foo(text BLOB)')
+ @db.execute('insert into foo(text) values (?)',SQLite3::Blob.new('hello'))
+ stmt = @db.prepare('select text from foo')
+ if stmt.respond_to?(:database_name)
+ assert_equal 'main', stmt.database_name(0)
+ end
+ end
+
+ def test_prepare_blob
+ @db.execute('create table foo(text BLOB)')
+ stmt = @db.prepare('insert into foo(text) values (?)')
+ stmt.bind_param(1, SQLite3::Blob.new('hello'))
+ stmt.step
+ stmt.close
+ end
+
+ def test_select_blob
+ @db.execute('create table foo(text BLOB)')
+ @db.execute('insert into foo(text) values (?)',SQLite3::Blob.new('hello'))
+ assert_equal 'hello', @db.execute('select * from foo').first.first
+ end
+
+ def test_new
+ assert @stmt
+ end
+
+ def test_new_closed_handle
+ @db = SQLite3::Database.new(':memory:')
+ @db.close
+ assert_raises(ArgumentError) do
+ SQLite3::Statement.new(@db, 'select "foo"')
+ end
+ end
+
+ def test_new_with_remainder
+ stmt = SQLite3::Statement.new(@db, "select 'foo';bar")
+ assert_equal 'bar', stmt.remainder
+ end
+
+ def test_empty_remainder
+ assert_equal '', @stmt.remainder
+ end
+
+ def test_close
+ @stmt.close
+ assert @stmt.closed?
+ end
+
+ def test_double_close
+ @stmt.close
+ assert_raises(SQLite3::Exception) do
+ @stmt.close
+ end
+ end
+
+ def test_bind_param_string
+ stmt = SQLite3::Statement.new(@db, "select ?")
+ stmt.bind_param(1, "hello")
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal ['hello'], result
+ end
+
+ def test_bind_param_int
+ stmt = SQLite3::Statement.new(@db, "select ?")
+ stmt.bind_param(1, 10)
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal [10], result
+ end
+
+ def test_bind_nil
+ stmt = SQLite3::Statement.new(@db, "select ?")
+ stmt.bind_param(1, nil)
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal [nil], result
+ end
+
+ def test_bind_blobs
+ end
+
+ def test_bind_64
+ stmt = SQLite3::Statement.new(@db, "select ?")
+ stmt.bind_param(1, 2 ** 31)
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal [2 ** 31], result
+ end
+
+ def test_bind_double
+ stmt = SQLite3::Statement.new(@db, "select ?")
+ stmt.bind_param(1, 2.2)
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal [2.2], result
+ end
+
+ def test_named_bind
+ stmt = SQLite3::Statement.new(@db, "select :foo")
+ stmt.bind_param(':foo', 'hello')
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal ['hello'], result
+ end
+
+ def test_named_bind_no_colon
+ stmt = SQLite3::Statement.new(@db, "select :foo")
+ stmt.bind_param('foo', 'hello')
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal ['hello'], result
+ end
+
+ def test_named_bind_symbol
+ stmt = SQLite3::Statement.new(@db, "select :foo")
+ stmt.bind_param(:foo, 'hello')
+ result = nil
+ stmt.each { |x| result = x }
+ assert_equal ['hello'], result
+ end
+
+ def test_named_bind_not_found
+ stmt = SQLite3::Statement.new(@db, "select :foo")
+ assert_raises(SQLite3::Exception) do
+ stmt.bind_param('bar', 'hello')
+ end
+ end
+
+ def test_each
+ r = nil
+ @stmt.each do |row|
+ r = row
+ end
+ assert_equal(['foo'], r)
+ end
+
+ def test_reset!
+ r = []
+ @stmt.each { |row| r << row }
+ @stmt.reset!
+ @stmt.each { |row| r << row }
+ assert_equal [['foo'], ['foo']], r
+ end
+
+ def test_step
+ r = @stmt.step
+ assert_equal ['foo'], r
+ end
+
+ def test_tainted
+ r = @stmt.step
+ assert r.first.tainted?
+ end
+
+ def test_step_twice
+ assert_not_nil @stmt.step
+ assert !@stmt.done?
+ assert_nil @stmt.step
+ assert @stmt.done?
+
+ @stmt.reset!
+ assert !@stmt.done?
+ end
+
+ def test_step_never_moves_past_done
+ 10.times { @stmt.step }
+ @stmt.done?
+ end
+
+ def test_column_count
+ assert_equal 1, @stmt.column_count
+ end
+
+ def test_column_name
+ assert_equal "'foo'", @stmt.column_name(0)
+ assert_equal nil, @stmt.column_name(10)
+ end
+
+ def test_bind_parameter_count
+ stmt = SQLite3::Statement.new(@db, "select ?, ?, ?")
+ assert_equal 3, stmt.bind_parameter_count
+ end
+
+ def test_execute_with_varargs
+ stmt = @db.prepare('select ?, ?')
+ assert_equal [[nil, nil]], stmt.execute(nil, nil).to_a
+ end
+
+ def test_execute_with_hash
+ stmt = @db.prepare('select :n, :h')
+ assert_equal [[10, nil]], stmt.execute('n' => 10, 'h' => nil).to_a
+ end
+ end
+end