do_sqlite3 0.10.1.1-x86-mingw32 → 0.10.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,7 @@
1
- ## 0.10.2 (unreleased, in git)
1
+ ## 0.10.2 2010-05-19
2
+ * Make Encoding.default_internal aware
3
+ * Rework logging for making callbacks possible
4
+ * Remove handling Object types directly
2
5
 
3
6
  ## 0.10.1.1 2010-01-24
4
7
 
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
11
11
  IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
12
12
  WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
13
13
  SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
14
- BINARY_VERSION = '3_6_21'
14
+ BINARY_VERSION = '3_6_23_1'
15
15
 
16
16
  CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_sqlite3/Makefile ext-java/target ])
17
17
 
@@ -35,7 +35,7 @@ begin
35
35
  # and modify dependencies and extensions appropriately
36
36
  gem.extensions << 'ext/do_sqlite3/extconf.rb'
37
37
 
38
- gem.add_dependency 'data_objects', '0.10.1'
38
+ gem.add_dependency 'data_objects', DataObjects::Sqlite3::VERSION
39
39
 
40
40
  gem.add_development_dependency 'bacon', '~>1.1'
41
41
  gem.add_development_dependency 'rake-compiler', '~>0.7'
@@ -1,69 +1,13 @@
1
- #include <ruby.h>
2
- #include <string.h>
3
- #include <math.h>
4
- #include <time.h>
5
- #include <locale.h>
6
- #include <sqlite3.h>
7
- #include "compat.h"
1
+ #include "do_sqlite3.h"
8
2
  #include "error.h"
9
-
10
- #ifdef HAVE_RUBY_ENCODING_H
11
- #include <ruby/encoding.h>
12
-
13
- #define DO_STR_NEW2(str, encoding) \
14
- ({ \
15
- VALUE _string = rb_str_new2((const char *)str); \
16
- if(encoding != -1) { \
17
- rb_enc_associate_index(_string, encoding); \
18
- } \
19
- _string; \
20
- })
21
-
22
- #define DO_STR_NEW(str, len, encoding) \
23
- ({ \
24
- VALUE _string = rb_str_new((const char *)str, (long)len); \
25
- if(encoding != -1) { \
26
- rb_enc_associate_index(_string, encoding); \
27
- } \
28
- _string; \
29
- })
30
-
31
- #else
32
-
33
- #define DO_STR_NEW2(str, encoding) \
34
- rb_str_new2((const char *)str)
35
-
36
- #define DO_STR_NEW(str, len, encoding) \
37
- rb_str_new((const char *)str, (long)len)
38
- #endif
39
-
40
-
41
- #define ID_CONST_GET rb_intern("const_get")
42
- #define ID_PATH rb_intern("path")
43
- #define ID_NEW rb_intern("new")
44
- #define ID_ESCAPE rb_intern("escape_sql")
45
- #define ID_QUERY rb_intern("query")
46
-
47
- #define RUBY_CLASS(name) rb_const_get(rb_cObject, rb_intern(name))
48
- #define CONST_GET(scope, constant) (rb_funcall(scope, ID_CONST_GET, 1, rb_str_new2(constant)))
49
- #define SQLITE3_CLASS(klass, parent) (rb_define_class_under(mSqlite3, klass, parent))
50
-
51
- #ifdef _WIN32
52
- #define do_int64 signed __int64
53
- #else
54
- #define do_int64 signed long long int
55
- #endif
56
-
57
- #ifndef HAVE_SQLITE3_PREPARE_V2
58
- #define sqlite3_prepare_v2 sqlite3_prepare
59
- #endif
60
-
61
3
  // To store rb_intern values
4
+
5
+ static ID ID_NEW;
62
6
  static ID ID_NEW_DATE;
7
+ static ID ID_CONST_GET;
63
8
  static ID ID_RATIONAL;
64
- static ID ID_LOGGER;
65
- static ID ID_DEBUG;
66
- static ID ID_LEVEL;
9
+ static ID ID_ESCAPE;
10
+ static ID ID_LOG;
67
11
 
68
12
  static VALUE mExtlib;
69
13
 
@@ -73,6 +17,8 @@ static VALUE cDO_Connection;
73
17
  static VALUE cDO_Command;
74
18
  static VALUE cDO_Result;
75
19
  static VALUE cDO_Reader;
20
+ static VALUE cDO_Logger;
21
+ static VALUE cDO_Logger_Message;
76
22
 
77
23
  static VALUE rb_cDate;
78
24
  static VALUE rb_cDateTime;
@@ -84,8 +30,6 @@ static VALUE cConnection;
84
30
  static VALUE cCommand;
85
31
  static VALUE cResult;
86
32
  static VALUE cReader;
87
-
88
- static VALUE eArgumentError;
89
33
  static VALUE eConnectionError;
90
34
  static VALUE eDataError;
91
35
 
@@ -120,28 +64,16 @@ static int jd_from_date(int year, int month, int day) {
120
64
  return (int) (floor(365.25 * (year + 4716)) + floor(30.6001 * (month + 1)) + day + b - 1524);
121
65
  }
122
66
 
123
- static void data_objects_debug(VALUE string, struct timeval* start) {
67
+ static void data_objects_debug(VALUE connection, VALUE string, struct timeval* start) {
124
68
  struct timeval stop;
125
- char *message;
126
-
127
- const char *query = rb_str_ptr_readonly(string);
128
- size_t length = rb_str_len(string);
129
- char total_time[32];
130
- do_int64 duration = 0;
131
-
132
- VALUE logger = rb_funcall(mSqlite3, ID_LOGGER, 0);
133
- int log_level = NUM2INT(rb_funcall(logger, ID_LEVEL, 0));
69
+ VALUE message;
134
70
 
135
- if (0 == log_level) {
136
- gettimeofday(&stop, NULL);
71
+ gettimeofday(&stop, NULL);
72
+ do_int64 duration = (stop.tv_sec - start->tv_sec) * 1000000 + stop.tv_usec - start->tv_usec;
137
73
 
138
- duration = (stop.tv_sec - start->tv_sec) * 1000000 + stop.tv_usec - start->tv_usec;
74
+ message = rb_funcall(cDO_Logger_Message, ID_NEW, 3, string, rb_time_new(start->tv_sec, start->tv_usec), INT2NUM(duration));
139
75
 
140
- snprintf(total_time, 32, "%.6f", duration / 1000000.0);
141
- message = (char *)calloc(length + strlen(total_time) + 4, sizeof(char));
142
- snprintf(message, length + strlen(total_time) + 4, "(%s) %s", total_time, query);
143
- rb_funcall(logger, ID_DEBUG, 1, rb_str_new(message, length + strlen(total_time) + 3));
144
- }
76
+ rb_funcall(connection, ID_LOG, 1, message);
145
77
  }
146
78
 
147
79
  static void raise_error(VALUE self, sqlite3 *result, VALUE query) {
@@ -330,6 +262,12 @@ static VALUE typecast(sqlite3_stmt *stmt, int i, VALUE type, int encoding) {
330
262
  return ruby_value;
331
263
  }
332
264
 
265
+ #ifdef HAVE_RUBY_ENCODING_H
266
+ rb_encoding * internal_encoding = rb_default_internal_encoding();
267
+ #else
268
+ void * internal_encoding = NULL;
269
+ #endif
270
+
333
271
  if(type == Qnil) {
334
272
  switch(original_type) {
335
273
  case SQLITE_INTEGER: {
@@ -354,7 +292,7 @@ static VALUE typecast(sqlite3_stmt *stmt, int i, VALUE type, int encoding) {
354
292
  if (type == rb_cInteger) {
355
293
  return LL2NUM(sqlite3_column_int64(stmt, i));
356
294
  } else if (type == rb_cString) {
357
- return DO_STR_NEW((char*)sqlite3_column_text(stmt, i), length, encoding);
295
+ return DO_STR_NEW((char*)sqlite3_column_text(stmt, i), length, encoding, internal_encoding);
358
296
  } else if (type == rb_cFloat) {
359
297
  return rb_float_new(sqlite3_column_double(stmt, i));
360
298
  } else if (type == rb_cBigDecimal) {
@@ -371,12 +309,10 @@ static VALUE typecast(sqlite3_stmt *stmt, int i, VALUE type, int encoding) {
371
309
  return rb_funcall(rb_cByteArray, ID_NEW, 1, rb_str_new((char*)sqlite3_column_blob(stmt, i), length));
372
310
  } else if (type == rb_cClass) {
373
311
  return rb_funcall(mDO, rb_intern("full_const_get"), 1, rb_str_new((char*)sqlite3_column_text(stmt, i), length));
374
- } else if (type == rb_cObject) {
375
- return rb_marshal_load(rb_str_new((char*)sqlite3_column_text(stmt, i), length));
376
312
  } else if (type == rb_cNilClass) {
377
313
  return Qnil;
378
314
  } else {
379
- return DO_STR_NEW((char*)sqlite3_column_text(stmt, i), length, encoding);
315
+ return DO_STR_NEW((char*)sqlite3_column_text(stmt, i), length, encoding, internal_encoding);
380
316
  }
381
317
  }
382
318
 
@@ -385,7 +321,7 @@ static VALUE typecast(sqlite3_stmt *stmt, int i, VALUE type, int encoding) {
385
321
  #define FLAG_PRESENT(query_values, flag) !NIL_P(rb_hash_aref(query_values, flag))
386
322
 
387
323
  static int flags_from_uri(VALUE uri) {
388
- VALUE query_values = rb_funcall(uri, ID_QUERY, 0);
324
+ VALUE query_values = rb_funcall(uri, rb_intern("query"), 0);
389
325
 
390
326
  int flags = 0;
391
327
 
@@ -425,7 +361,7 @@ static VALUE cConnection_initialize(VALUE self, VALUE uri) {
425
361
  VALUE path;
426
362
  sqlite3 *db;
427
363
 
428
- path = rb_funcall(uri, ID_PATH, 0);
364
+ path = rb_funcall(uri, rb_intern("path"), 0);
429
365
 
430
366
  #ifdef HAVE_SQLITE3_OPEN_V2
431
367
  ret = sqlite3_open_v2(rb_str_ptr_readonly(path), &db, flags_from_uri(uri), 0);
@@ -488,11 +424,11 @@ static VALUE cCommand_set_types(int argc, VALUE *argv, VALUE self) {
488
424
  if(TYPE(sub_entry) == T_CLASS) {
489
425
  rb_ary_push(type_strings, sub_entry);
490
426
  } else {
491
- rb_raise(eArgumentError, "Invalid type given");
427
+ rb_raise(rb_eArgError, "Invalid type given");
492
428
  }
493
429
  }
494
430
  } else {
495
- rb_raise(eArgumentError, "Invalid type given");
431
+ rb_raise(rb_eArgError, "Invalid type given");
496
432
  }
497
433
  }
498
434
 
@@ -570,7 +506,7 @@ static VALUE cCommand_execute_non_query(int argc, VALUE *argv, VALUE self) {
570
506
  if ( status != SQLITE_OK ) {
571
507
  raise_error(self, db, query);
572
508
  }
573
- data_objects_debug(query, &start);
509
+ data_objects_debug(connection, query, &start);
574
510
 
575
511
  affected_rows = sqlite3_changes(db);
576
512
  insert_id = sqlite3_last_insert_rowid(db);
@@ -602,7 +538,7 @@ static VALUE cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
602
538
 
603
539
  gettimeofday(&start, NULL);
604
540
  status = sqlite3_prepare_v2(db, rb_str_ptr_readonly(query), -1, &sqlite3_reader, 0);
605
- data_objects_debug(query, &start);
541
+ data_objects_debug(connection, query, &start);
606
542
 
607
543
  if ( status != SQLITE_OK ) {
608
544
  raise_error(self, db, query);
@@ -624,7 +560,7 @@ static VALUE cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
624
560
  // Whoops... wrong number of types passed to set_types. Close the reader and raise
625
561
  // and error
626
562
  rb_funcall(reader, rb_intern("close"), 0);
627
- rb_raise(eArgumentError, "Field-count mismatch. Expected %ld fields, but the query yielded %d", RARRAY_LEN(field_types), field_count);
563
+ rb_raise(rb_eArgError, "Field-count mismatch. Expected %ld fields, but the query yielded %d", RARRAY_LEN(field_types), field_count);
628
564
  }
629
565
 
630
566
  for ( i = 0; i < field_count; i++ ) {
@@ -720,13 +656,14 @@ static VALUE cReader_field_count(VALUE self) {
720
656
  void Init_do_sqlite3() {
721
657
  rb_require("bigdecimal");
722
658
  rb_require("date");
659
+ rb_require("data_objects");
723
660
 
724
- // Get references classes needed for Date/Time parsing
725
- rb_cDate = RUBY_CLASS("Date");
726
- rb_cDateTime = RUBY_CLASS( "DateTime");
727
- rb_cBigDecimal = RUBY_CLASS("BigDecimal");
661
+ ID_CONST_GET = rb_intern("const_get");
728
662
 
729
- rb_funcall(rb_mKernel, rb_intern("require"), 1, rb_str_new2("data_objects"));
663
+ // Get references classes needed for Date/Time parsing
664
+ rb_cDate = CONST_GET(rb_mKernel, "Date");
665
+ rb_cDateTime = CONST_GET(rb_mKernel, "DateTime");
666
+ rb_cBigDecimal = CONST_GET(rb_mKernel, "BigDecimal");
730
667
 
731
668
  #ifdef RUBY_LESS_THAN_186
732
669
  ID_NEW_DATE = rb_intern("new0");
@@ -734,9 +671,9 @@ void Init_do_sqlite3() {
734
671
  ID_NEW_DATE = rb_intern("new!");
735
672
  #endif
736
673
  ID_RATIONAL = rb_intern("Rational");
737
- ID_LOGGER = rb_intern("logger");
738
- ID_DEBUG = rb_intern("debug");
739
- ID_LEVEL = rb_intern("level");
674
+ ID_NEW = rb_intern("new");
675
+ ID_ESCAPE = rb_intern("escape_sql");
676
+ ID_LOG = rb_intern("log");
740
677
 
741
678
  // Get references to the Extlib module
742
679
  mExtlib = CONST_GET(rb_mKernel, "Extlib");
@@ -749,15 +686,16 @@ void Init_do_sqlite3() {
749
686
  cDO_Command = CONST_GET(mDO, "Command");
750
687
  cDO_Result = CONST_GET(mDO, "Result");
751
688
  cDO_Reader = CONST_GET(mDO, "Reader");
689
+ cDO_Logger = CONST_GET(mDO, "Logger");
690
+ cDO_Logger_Message = CONST_GET(cDO_Logger, "Message");
752
691
 
753
692
  // Initialize the DataObjects::Sqlite3 module, and define its classes
754
693
  mSqlite3 = rb_define_module_under(mDO, "Sqlite3");
755
694
 
756
- eArgumentError = CONST_GET(rb_mKernel, "ArgumentError");
757
695
  eConnectionError = CONST_GET(mDO, "ConnectionError");
758
696
  eDataError = CONST_GET(mDO, "DataError");
759
697
 
760
- cConnection = SQLITE3_CLASS("Connection", cDO_Connection);
698
+ cConnection = DRIVER_CLASS("Connection", cDO_Connection);
761
699
  rb_define_method(cConnection, "initialize", cConnection_initialize, 1);
762
700
  rb_define_method(cConnection, "dispose", cConnection_dispose, 0);
763
701
  rb_define_method(cConnection, "quote_boolean", cConnection_quote_boolean, 1);
@@ -765,20 +703,41 @@ void Init_do_sqlite3() {
765
703
  rb_define_method(cConnection, "quote_byte_array", cConnection_quote_byte_array, 1);
766
704
  rb_define_method(cConnection, "character_set", cConnection_character_set, 0);
767
705
 
768
- cCommand = SQLITE3_CLASS("Command", cDO_Command);
706
+ cCommand = DRIVER_CLASS("Command", cDO_Command);
769
707
  rb_define_method(cCommand, "set_types", cCommand_set_types, -1);
770
708
  rb_define_method(cCommand, "execute_non_query", cCommand_execute_non_query, -1);
771
709
  rb_define_method(cCommand, "execute_reader", cCommand_execute_reader, -1);
772
710
 
773
- cResult = SQLITE3_CLASS("Result", cDO_Result);
711
+ cResult = DRIVER_CLASS("Result", cDO_Result);
774
712
 
775
- cReader = SQLITE3_CLASS("Reader", cDO_Reader);
713
+ cReader = DRIVER_CLASS("Reader", cDO_Reader);
776
714
  rb_define_method(cReader, "close", cReader_close, 0);
777
715
  rb_define_method(cReader, "next!", cReader_next, 0);
778
716
  rb_define_method(cReader, "values", cReader_values, 0);
779
717
  rb_define_method(cReader, "fields", cReader_fields, 0);
780
718
  rb_define_method(cReader, "field_count", cReader_field_count, 0);
781
719
 
720
+ rb_global_variable(&ID_NEW_DATE);
721
+ rb_global_variable(&ID_RATIONAL);
722
+ rb_global_variable(&ID_CONST_GET);
723
+ rb_global_variable(&ID_ESCAPE);
724
+ rb_global_variable(&ID_LOG);
725
+ rb_global_variable(&ID_NEW);
726
+
727
+ rb_global_variable(&rb_cDate);
728
+ rb_global_variable(&rb_cDateTime);
729
+ rb_global_variable(&rb_cBigDecimal);
730
+ rb_global_variable(&rb_cByteArray);
731
+
732
+ rb_global_variable(&mDO);
733
+ rb_global_variable(&cDO_Logger_Message);
734
+
735
+ rb_global_variable(&cResult);
736
+ rb_global_variable(&cReader);
737
+
738
+ rb_global_variable(&eConnectionError);
739
+ rb_global_variable(&eDataError);
740
+
782
741
  OPEN_FLAG_READONLY = rb_str_new2("read_only");
783
742
  rb_global_variable(&OPEN_FLAG_READONLY);
784
743
  OPEN_FLAG_READWRITE = rb_str_new2("read_write");
@@ -790,4 +749,5 @@ void Init_do_sqlite3() {
790
749
  OPEN_FLAG_FULL_MUTEX = rb_str_new2("full_mutex");
791
750
  rb_global_variable(&OPEN_FLAG_FULL_MUTEX);
792
751
 
752
+ Init_do_sqlite3_extension();
793
753
  }
@@ -0,0 +1,65 @@
1
+ #ifndef DO_SQLITE3_H
2
+ #define DO_SQLITE3_H
3
+
4
+ #include <ruby.h>
5
+ #include <string.h>
6
+ #include <math.h>
7
+ #include <time.h>
8
+ #include <locale.h>
9
+ #include <sqlite3.h>
10
+ #include "compat.h"
11
+
12
+ #ifdef HAVE_RUBY_ENCODING_H
13
+ #include <ruby/encoding.h>
14
+
15
+ #define DO_STR_NEW2(str, encoding, internal_encoding) \
16
+ ({ \
17
+ VALUE _string = rb_str_new2((const char *)str); \
18
+ if(encoding != -1) { \
19
+ rb_enc_associate_index(_string, encoding); \
20
+ } \
21
+ if(internal_encoding) { \
22
+ _string = rb_str_export_to_enc(_string, internal_encoding); \
23
+ } \
24
+ _string; \
25
+ })
26
+
27
+ #define DO_STR_NEW(str, len, encoding, internal_encoding) \
28
+ ({ \
29
+ VALUE _string = rb_str_new((const char *)str, (long)len); \
30
+ if(encoding != -1) { \
31
+ rb_enc_associate_index(_string, encoding); \
32
+ } \
33
+ if(internal_encoding) { \
34
+ _string = rb_str_export_to_enc(_string, internal_encoding); \
35
+ } \
36
+ _string; \
37
+ })
38
+
39
+ #else
40
+
41
+ #define DO_STR_NEW2(str, encoding, internal_encoding) \
42
+ rb_str_new2((const char *)str)
43
+
44
+ #define DO_STR_NEW(str, len, encoding, internal_encoding) \
45
+ rb_str_new((const char *)str, (long)len)
46
+ #endif
47
+
48
+ #define CONST_GET(scope, constant) (rb_funcall(scope, ID_CONST_GET, 1, rb_str_new2(constant)))
49
+ #define DRIVER_CLASS(klass, parent) (rb_define_class_under(mSqlite3, klass, parent))
50
+
51
+ #ifdef _WIN32
52
+ #define do_int64 signed __int64
53
+ #else
54
+ #define do_int64 signed long long int
55
+ #endif
56
+
57
+ #ifndef HAVE_SQLITE3_PREPARE_V2
58
+ #define sqlite3_prepare_v2 sqlite3_prepare
59
+ #endif
60
+
61
+ static ID ID_CONST_GET;
62
+
63
+ void Init_do_sqlite3_extension();
64
+
65
+ #endif
@@ -0,0 +1,78 @@
1
+ #include "do_sqlite3.h"
2
+
3
+ static VALUE ID_CONST_GET;
4
+ static VALUE mDO;
5
+ static VALUE mSqlite3;
6
+ static VALUE eConnectionError;
7
+ static VALUE cDO_Extension;
8
+ static VALUE cExtension;
9
+
10
+ /*****************************************************/
11
+ /* File used for providing extensions on the default */
12
+ /* API that are driver specific. */
13
+ /*****************************************************/
14
+ static VALUE cExtension_enable_load_extension(VALUE self, VALUE on) {
15
+ VALUE id_connection = rb_intern("connection");
16
+
17
+ VALUE connection = rb_funcall(self, id_connection, 0);
18
+ sqlite3 *db;
19
+ int status;
20
+
21
+ if (connection == Qnil) { return Qfalse; }
22
+
23
+ // Retrieve the actual connection from the
24
+ connection = rb_iv_get(self, "@connection");
25
+
26
+ if (connection == Qnil) { return Qfalse; }
27
+
28
+ db = DATA_PTR(connection);
29
+
30
+ if(db == NULL) { return Qfalse; }
31
+
32
+ status = sqlite3_enable_load_extension(db, on == Qtrue ? 1 : 0);
33
+
34
+ if ( status != SQLITE_OK ) {
35
+ rb_raise(eConnectionError, "Couldn't enable extension loading");
36
+ }
37
+ return Qtrue;
38
+ }
39
+
40
+ static VALUE cExtension_load_extension(VALUE self, VALUE path) {
41
+ VALUE id_connection = rb_intern("connection");
42
+
43
+ VALUE connection = rb_funcall(self, id_connection, 0);
44
+ sqlite3 *db;
45
+ const char *extension_path = rb_str_ptr_readonly(path);
46
+ char* errmsg = sqlite3_malloc(1024);
47
+ int status;
48
+
49
+ if (connection == Qnil) { return Qfalse; }
50
+
51
+ // Retrieve the actual connection from the
52
+ connection = rb_iv_get(self, "@connection");
53
+
54
+ if (connection == Qnil) { return Qfalse; }
55
+
56
+ db = DATA_PTR(connection);
57
+
58
+ if(db == NULL) { return Qfalse; }
59
+
60
+ status = sqlite3_load_extension(db, extension_path, 0, &errmsg);
61
+
62
+ if ( status != SQLITE_OK ) {
63
+ VALUE errexp = rb_exc_new2(eConnectionError, errmsg);
64
+ sqlite3_free(errmsg);
65
+ rb_exc_raise(errexp);
66
+ }
67
+ return Qtrue;
68
+ }
69
+
70
+ void Init_do_sqlite3_extension() {
71
+ ID_CONST_GET = rb_intern("const_get");
72
+ mDO = CONST_GET(rb_mKernel, "DataObjects");
73
+ cDO_Extension = CONST_GET(mDO, "Extension");
74
+ mSqlite3 = rb_define_module_under(mDO, "Sqlite3");
75
+ cExtension = DRIVER_CLASS("Extension", cDO_Extension);
76
+ rb_define_method(cExtension, "load_extension", cExtension_load_extension, 1);
77
+ rb_define_method(cExtension, "enable_load_extension", cExtension_enable_load_extension, 1);
78
+ }
@@ -1,3 +1,6 @@
1
+ #ifndef DO_SQLITE3_ERROR_H
2
+ #define DO_SQLITE3_ERROR_H
3
+
1
4
  static struct errcodes {
2
5
  int error_no;
3
6
  const char *error_name;
@@ -104,3 +107,5 @@ static struct errcodes {
104
107
  #endif
105
108
  {0, NULL, NULL}
106
109
  };
110
+
111
+ #endif
@@ -1,5 +1,5 @@
1
1
  module DataObjects
2
2
  module Sqlite3
3
- VERSION = '0.10.1.1'.freeze
3
+ VERSION = '0.10.2'
4
4
  end
5
5
  end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
4
+ require 'data_objects/spec/encoding_spec'
5
+
6
+ describe DataObjects::Sqlite3::Connection do
7
+ behaves_like 'returning correctly encoded strings for the default database encoding'
8
+ behaves_like 'returning correctly encoded strings for the default internal encoding'
9
+ end
@@ -15,5 +15,5 @@ describe DataObjects::Sqlite3::Result do
15
15
  end
16
16
 
17
17
  describe DataObjects::Sqlite3::Result do
18
- behaves_like 'a Result which returns inserted keys'
18
+ behaves_like 'a Result which returns inserted key with sequences'
19
19
  end
@@ -61,9 +61,8 @@ module DataObjectsSpecHelpers
61
61
 
62
62
  conn.create_command(<<-EOF).execute_non_query
63
63
  CREATE TABLE "invoices" (
64
- "id" SERIAL,
65
64
  "invoice_number" varchar(50) NOT NULL,
66
- PRIMARY KEY ("id")
65
+ PRIMARY KEY ("invoice_number")
67
66
  );
68
67
  EOF
69
68
 
@@ -56,7 +56,7 @@ begin
56
56
  ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
57
57
  ext.java_compiling do |gem|
58
58
  gem.add_dependency 'jdbc-sqlite3', '>=3.5.8'
59
- gem.add_dependency 'do_jdbc', '0.10.1'
59
+ gem.add_dependency 'do_jdbc', '0.10.2'
60
60
  end
61
61
  end
62
62
  rescue LoadError
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 10
8
+ - 2
9
+ version: 0.10.2
5
10
  platform: x86-mingw32
6
11
  authors:
7
12
  - Dirkjan Bussink
@@ -9,39 +14,49 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-31 00:00:00 +01:00
17
+ date: 2010-05-19 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: data_objects
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - "="
22
26
  - !ruby/object:Gem::Version
23
- version: 0.10.1
24
- version:
27
+ segments:
28
+ - 0
29
+ - 10
30
+ - 2
31
+ version: 0.10.2
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: bacon
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ~>
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 1
33
44
  version: "1.1"
34
- version:
45
+ type: :development
46
+ version_requirements: *id002
35
47
  - !ruby/object:Gem::Dependency
36
48
  name: rake-compiler
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
40
51
  requirements:
41
52
  - - ~>
42
53
  - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ - 7
43
57
  version: "0.7"
44
- version:
58
+ type: :development
59
+ version_requirements: *id003
45
60
  description: Implements the DataObjects API for Sqlite3
46
61
  email: d.bussink@gmail.com
47
62
  executables: []
@@ -58,6 +73,7 @@ files:
58
73
  - lib/do_sqlite3.rb
59
74
  - spec/command_spec.rb
60
75
  - spec/connection_spec.rb
76
+ - spec/encoding_spec.rb
61
77
  - spec/reader_spec.rb
62
78
  - spec/result_spec.rb
63
79
  - spec/spec_helper.rb
@@ -81,7 +97,9 @@ files:
81
97
  - tasks/spec.rake
82
98
  - ext/do_sqlite3/extconf.rb
83
99
  - ext/do_sqlite3/do_sqlite3.c
100
+ - ext/do_sqlite3/do_sqlite3_extension.c
84
101
  - ext/do_sqlite3/compat.h
102
+ - ext/do_sqlite3/do_sqlite3.h
85
103
  - ext/do_sqlite3/error.h
86
104
  - LICENSE
87
105
  - Rakefile
@@ -98,13 +116,13 @@ post_install_message: |+
98
116
  =============================================================================
99
117
 
100
118
  You've installed the binary version of do_sqlite3.
101
- It was built using Sqlite3 version 3_6_21.
119
+ It was built using Sqlite3 version 3_6_23_1.
102
120
  It's recommended to use the exact same version to avoid potential issues.
103
121
 
104
122
  At the time of building this gem, the necessary DLL files where available
105
123
  in the following download:
106
124
 
107
- http://www.sqlite.org/sqlitedll-3_6_21.zip
125
+ http://www.sqlite.org/sqlitedll-3_6_23_1.zip
108
126
 
109
127
  You can put the sqlite3.dll available in this package in your Ruby bin
110
128
  directory, for example C:\Ruby\bin
@@ -119,24 +137,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
137
  requirements:
120
138
  - - ">="
121
139
  - !ruby/object:Gem::Version
140
+ segments:
141
+ - 0
122
142
  version: "0"
123
- version:
124
143
  required_rubygems_version: !ruby/object:Gem::Requirement
125
144
  requirements:
126
145
  - - ">="
127
146
  - !ruby/object:Gem::Version
147
+ segments:
148
+ - 0
128
149
  version: "0"
129
- version:
130
150
  requirements: []
131
151
 
132
152
  rubyforge_project: dorb
133
- rubygems_version: 1.3.5
153
+ rubygems_version: 1.3.6
134
154
  signing_key:
135
155
  specification_version: 3
136
156
  summary: DataObjects Sqlite3 Driver
137
157
  test_files:
138
158
  - spec/command_spec.rb
139
159
  - spec/connection_spec.rb
160
+ - spec/encoding_spec.rb
140
161
  - spec/reader_spec.rb
141
162
  - spec/result_spec.rb
142
163
  - spec/spec_helper.rb