mockley_crew 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mockley_crew/version.rb +1 -1
- data/vendor/gems/sqlite3/cache/sqlite3-1.3.13.gem +0 -0
- data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/gem.build_complete +0 -0
- data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/gem_make.out +33 -0
- data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/mkmf.log +592 -0
- data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/sqlite3/sqlite3_native.so +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/API_CHANGES.rdoc +50 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/CHANGELOG.rdoc +292 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ChangeLog.cvs +88 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/Gemfile +15 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/LICENSE +27 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/Manifest.txt +52 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/README.rdoc +118 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/Rakefile +10 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/Makefile +263 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/backup.c +168 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/backup.h +15 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/backup.o +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/database.c +888 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/database.h +15 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/database.o +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/exception.c +94 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/exception.h +8 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/exception.o +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/extconf.rb +71 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3.c +152 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3.o +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3_native.so +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3_ruby.h +52 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/statement.c +447 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/statement.h +16 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/statement.o +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/faq/faq.rb +145 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/faq/faq.yml +426 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/constants.rb +49 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/database.rb +591 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/errors.rb +44 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/pragmas.rb +588 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/resultset.rb +195 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.so +0 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb +144 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/translator.rb +118 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/value.rb +57 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/version.rb +25 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3.rb +15 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/setup.rb +1333 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/faq.rake +9 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/gem.rake +38 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/native.rake +52 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/vendor_sqlite3.rake +97 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/helper.rb +18 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_backup.rb +33 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_collation.rb +82 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_database.rb +430 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_database_readonly.rb +36 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_deprecated.rb +44 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_encoding.rb +155 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration.rb +576 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_open_close.rb +30 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_pending.rb +115 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_resultset.rb +159 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_statement.rb +194 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_result_set.rb +37 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_sqlite3.rb +21 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_statement.rb +260 -0
- data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_statement_execute.rb +35 -0
- data/vendor/gems/sqlite3/specifications/sqlite3-1.3.13.gemspec +56 -0
- metadata +67 -1
@@ -0,0 +1,15 @@
|
|
1
|
+
#ifndef SQLITE3_DATABASE_RUBY
|
2
|
+
#define SQLITE3_DATABASE_RUBY
|
3
|
+
|
4
|
+
#include <sqlite3_ruby.h>
|
5
|
+
|
6
|
+
struct _sqlite3Ruby {
|
7
|
+
sqlite3 *db;
|
8
|
+
};
|
9
|
+
|
10
|
+
typedef struct _sqlite3Ruby sqlite3Ruby;
|
11
|
+
typedef sqlite3Ruby * sqlite3RubyPtr;
|
12
|
+
|
13
|
+
void init_sqlite3_database();
|
14
|
+
|
15
|
+
#endif
|
Binary file
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#include <sqlite3_ruby.h>
|
2
|
+
|
3
|
+
void rb_sqlite3_raise(sqlite3 * db, int status)
|
4
|
+
{
|
5
|
+
VALUE klass = Qnil;
|
6
|
+
|
7
|
+
switch(status) {
|
8
|
+
case SQLITE_OK:
|
9
|
+
return;
|
10
|
+
break;
|
11
|
+
case SQLITE_ERROR:
|
12
|
+
klass = rb_path2class("SQLite3::SQLException");
|
13
|
+
break;
|
14
|
+
case SQLITE_INTERNAL:
|
15
|
+
klass = rb_path2class("SQLite3::InternalException");
|
16
|
+
break;
|
17
|
+
case SQLITE_PERM:
|
18
|
+
klass = rb_path2class("SQLite3::PermissionException");
|
19
|
+
break;
|
20
|
+
case SQLITE_ABORT:
|
21
|
+
klass = rb_path2class("SQLite3::AbortException");
|
22
|
+
break;
|
23
|
+
case SQLITE_BUSY:
|
24
|
+
klass = rb_path2class("SQLite3::BusyException");
|
25
|
+
break;
|
26
|
+
case SQLITE_LOCKED:
|
27
|
+
klass = rb_path2class("SQLite3::LockedException");
|
28
|
+
break;
|
29
|
+
case SQLITE_NOMEM:
|
30
|
+
klass = rb_path2class("SQLite3::MemoryException");
|
31
|
+
break;
|
32
|
+
case SQLITE_READONLY:
|
33
|
+
klass = rb_path2class("SQLite3::ReadOnlyException");
|
34
|
+
break;
|
35
|
+
case SQLITE_INTERRUPT:
|
36
|
+
klass = rb_path2class("SQLite3::InterruptException");
|
37
|
+
break;
|
38
|
+
case SQLITE_IOERR:
|
39
|
+
klass = rb_path2class("SQLite3::IOException");
|
40
|
+
break;
|
41
|
+
case SQLITE_CORRUPT:
|
42
|
+
klass = rb_path2class("SQLite3::CorruptException");
|
43
|
+
break;
|
44
|
+
case SQLITE_NOTFOUND:
|
45
|
+
klass = rb_path2class("SQLite3::NotFoundException");
|
46
|
+
break;
|
47
|
+
case SQLITE_FULL:
|
48
|
+
klass = rb_path2class("SQLite3::FullException");
|
49
|
+
break;
|
50
|
+
case SQLITE_CANTOPEN:
|
51
|
+
klass = rb_path2class("SQLite3::CantOpenException");
|
52
|
+
break;
|
53
|
+
case SQLITE_PROTOCOL:
|
54
|
+
klass = rb_path2class("SQLite3::ProtocolException");
|
55
|
+
break;
|
56
|
+
case SQLITE_EMPTY:
|
57
|
+
klass = rb_path2class("SQLite3::EmptyException");
|
58
|
+
break;
|
59
|
+
case SQLITE_SCHEMA:
|
60
|
+
klass = rb_path2class("SQLite3::SchemaChangedException");
|
61
|
+
break;
|
62
|
+
case SQLITE_TOOBIG:
|
63
|
+
klass = rb_path2class("SQLite3::TooBigException");
|
64
|
+
break;
|
65
|
+
case SQLITE_CONSTRAINT:
|
66
|
+
klass = rb_path2class("SQLite3::ConstraintException");
|
67
|
+
break;
|
68
|
+
case SQLITE_MISMATCH:
|
69
|
+
klass = rb_path2class("SQLite3::MismatchException");
|
70
|
+
break;
|
71
|
+
case SQLITE_MISUSE:
|
72
|
+
klass = rb_path2class("SQLite3::MisuseException");
|
73
|
+
break;
|
74
|
+
case SQLITE_NOLFS:
|
75
|
+
klass = rb_path2class("SQLite3::UnsupportedException");
|
76
|
+
break;
|
77
|
+
case SQLITE_AUTH:
|
78
|
+
klass = rb_path2class("SQLite3::AuthorizationException");
|
79
|
+
break;
|
80
|
+
case SQLITE_FORMAT:
|
81
|
+
klass = rb_path2class("SQLite3::FormatException");
|
82
|
+
break;
|
83
|
+
case SQLITE_RANGE:
|
84
|
+
klass = rb_path2class("SQLite3::RangeException");
|
85
|
+
break;
|
86
|
+
case SQLITE_NOTADB:
|
87
|
+
klass = rb_path2class("SQLite3::NotADatabaseException");
|
88
|
+
break;
|
89
|
+
default:
|
90
|
+
klass = rb_eRuntimeError;
|
91
|
+
}
|
92
|
+
|
93
|
+
rb_raise(klass, "%s", sqlite3_errmsg(db));
|
94
|
+
}
|
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/
|
2
|
+
|
3
|
+
require 'mkmf'
|
4
|
+
|
5
|
+
# :stopdoc:
|
6
|
+
|
7
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
ldflags = cppflags = nil
|
12
|
+
if RbConfig::CONFIG["host_os"] =~ /darwin/
|
13
|
+
begin
|
14
|
+
brew_prefix = `brew --prefix sqlite3`.chomp
|
15
|
+
ldflags = "#{brew_prefix}/lib"
|
16
|
+
cppflags = "#{brew_prefix}/include"
|
17
|
+
pkg_conf = "#{brew_prefix}/lib/pkgconfig"
|
18
|
+
|
19
|
+
# pkg_config should be less error prone than parsing compiler
|
20
|
+
# commandline options, but we need to set default ldflags and cpp flags
|
21
|
+
# in case the user doesn't have pkg-config installed
|
22
|
+
ENV['PKG_CONFIG_PATH'] ||= pkg_conf
|
23
|
+
rescue
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
pkg_config("sqlite3")
|
28
|
+
|
29
|
+
# --with-sqlite3-{dir,include,lib}
|
30
|
+
dir_config("sqlite3", cppflags, ldflags)
|
31
|
+
|
32
|
+
if RbConfig::CONFIG["host_os"] =~ /mswin/
|
33
|
+
$CFLAGS << ' -W3'
|
34
|
+
end
|
35
|
+
|
36
|
+
def asplode missing
|
37
|
+
if RUBY_PLATFORM =~ /mingw|mswin/
|
38
|
+
abort "#{missing} is missing. Install SQLite3 from " +
|
39
|
+
"http://www.sqlite.org/ first."
|
40
|
+
else
|
41
|
+
abort <<-error
|
42
|
+
#{missing} is missing. Try 'brew install sqlite3',
|
43
|
+
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
|
44
|
+
and check your shared library search path (the
|
45
|
+
location where your sqlite3 shared library is located).
|
46
|
+
error
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
asplode('sqlite3.h') unless find_header 'sqlite3.h'
|
51
|
+
find_library 'pthread', 'pthread_create' # 1.8 support. *shrug*
|
52
|
+
asplode('sqlite3') unless find_library 'sqlite3', 'sqlite3_libversion_number'
|
53
|
+
|
54
|
+
# Functions defined in 1.9 but not 1.8
|
55
|
+
have_func('rb_proc_arity')
|
56
|
+
|
57
|
+
# Functions defined in 2.1 but not 2.0
|
58
|
+
have_func('rb_integer_pack')
|
59
|
+
|
60
|
+
# These functions may not be defined
|
61
|
+
have_func('sqlite3_initialize')
|
62
|
+
have_func('sqlite3_backup_init')
|
63
|
+
have_func('sqlite3_column_database_name')
|
64
|
+
have_func('sqlite3_enable_load_extension')
|
65
|
+
have_func('sqlite3_load_extension')
|
66
|
+
have_func('sqlite3_open_v2')
|
67
|
+
have_func('sqlite3_prepare_v2')
|
68
|
+
have_type('sqlite3_int64', 'sqlite3.h')
|
69
|
+
have_type('sqlite3_uint64', 'sqlite3.h')
|
70
|
+
|
71
|
+
create_makefile('sqlite3/sqlite3_native')
|
@@ -0,0 +1,152 @@
|
|
1
|
+
#include <sqlite3_ruby.h>
|
2
|
+
|
3
|
+
VALUE mSqlite3;
|
4
|
+
VALUE cSqlite3Blob;
|
5
|
+
|
6
|
+
int bignum_to_int64(VALUE value, sqlite3_int64 *result)
|
7
|
+
{
|
8
|
+
#ifdef HAVE_RB_INTEGER_PACK
|
9
|
+
const int nails = 0;
|
10
|
+
int t = rb_integer_pack(value, result, 1, sizeof(*result), nails,
|
11
|
+
INTEGER_PACK_NATIVE_BYTE_ORDER|
|
12
|
+
INTEGER_PACK_2COMP);
|
13
|
+
switch (t) {
|
14
|
+
case -2: case +2:
|
15
|
+
return 0;
|
16
|
+
case +1:
|
17
|
+
if (!nails) {
|
18
|
+
if (*result < 0) return 0;
|
19
|
+
}
|
20
|
+
break;
|
21
|
+
case -1:
|
22
|
+
if (!nails) {
|
23
|
+
if (*result >= 0) return 0;
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
*result += INT64_MIN;
|
27
|
+
}
|
28
|
+
break;
|
29
|
+
}
|
30
|
+
return 1;
|
31
|
+
#else
|
32
|
+
# ifndef RBIGNUM_LEN
|
33
|
+
# define RBIGNUM_LEN(x) RBIGNUM(x)->len
|
34
|
+
# endif
|
35
|
+
const long len = RBIGNUM_LEN(value);
|
36
|
+
if (len == 0) {
|
37
|
+
*result = 0;
|
38
|
+
return 1;
|
39
|
+
}
|
40
|
+
if (len > 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) return 0;
|
41
|
+
if (len == 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) {
|
42
|
+
const BDIGIT *digits = RBIGNUM_DIGITS(value);
|
43
|
+
BDIGIT blast = digits[len-1];
|
44
|
+
BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
|
45
|
+
if (blast > bmax) return 0;
|
46
|
+
if (blast == bmax) {
|
47
|
+
if (RBIGNUM_POSITIVE_P(value)) {
|
48
|
+
return 0;
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
long i = len-1;
|
52
|
+
while (i) {
|
53
|
+
if (digits[--i]) return 0;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
*result = (sqlite3_int64)NUM2LL(value);
|
59
|
+
return 1;
|
60
|
+
#endif
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE libversion(VALUE UNUSED(klass))
|
64
|
+
{
|
65
|
+
return INT2NUM(sqlite3_libversion_number());
|
66
|
+
}
|
67
|
+
|
68
|
+
/* Returns the compile time setting of the SQLITE_THREADSAFE flag.
|
69
|
+
* See: https://www.sqlite.org/c3ref/threadsafe.html
|
70
|
+
*/
|
71
|
+
static VALUE threadsafe_p(VALUE UNUSED(klass))
|
72
|
+
{
|
73
|
+
return INT2NUM(sqlite3_threadsafe());
|
74
|
+
}
|
75
|
+
|
76
|
+
void init_sqlite3_constants()
|
77
|
+
{
|
78
|
+
VALUE mSqlite3Constants;
|
79
|
+
VALUE mSqlite3Open;
|
80
|
+
|
81
|
+
mSqlite3Constants = rb_define_module_under(mSqlite3, "Constants");
|
82
|
+
|
83
|
+
/* sqlite3_open_v2 flags for Database::new */
|
84
|
+
mSqlite3Open = rb_define_module_under(mSqlite3Constants, "Open");
|
85
|
+
|
86
|
+
/* symbols = IO.readlines('sqlite3.h').map { |n| /\A#define\s+(SQLITE_OPEN_\w+)\s/ =~ n && $1 }.compact
|
87
|
+
* pad = symbols.map(&:length).max - 9
|
88
|
+
* symbols.each { |s| printf %Q{ rb_define_const(mSqlite3Open, %-#{pad}s INT2FIX(#{s}));\n}, '"' + s[12..-1] + '",' }
|
89
|
+
*/
|
90
|
+
rb_define_const(mSqlite3Open, "READONLY", INT2FIX(SQLITE_OPEN_READONLY));
|
91
|
+
rb_define_const(mSqlite3Open, "READWRITE", INT2FIX(SQLITE_OPEN_READWRITE));
|
92
|
+
rb_define_const(mSqlite3Open, "CREATE", INT2FIX(SQLITE_OPEN_CREATE));
|
93
|
+
rb_define_const(mSqlite3Open, "DELETEONCLOSE", INT2FIX(SQLITE_OPEN_DELETEONCLOSE));
|
94
|
+
rb_define_const(mSqlite3Open, "EXCLUSIVE", INT2FIX(SQLITE_OPEN_EXCLUSIVE));
|
95
|
+
rb_define_const(mSqlite3Open, "MAIN_DB", INT2FIX(SQLITE_OPEN_MAIN_DB));
|
96
|
+
rb_define_const(mSqlite3Open, "TEMP_DB", INT2FIX(SQLITE_OPEN_TEMP_DB));
|
97
|
+
rb_define_const(mSqlite3Open, "TRANSIENT_DB", INT2FIX(SQLITE_OPEN_TRANSIENT_DB));
|
98
|
+
rb_define_const(mSqlite3Open, "MAIN_JOURNAL", INT2FIX(SQLITE_OPEN_MAIN_JOURNAL));
|
99
|
+
rb_define_const(mSqlite3Open, "TEMP_JOURNAL", INT2FIX(SQLITE_OPEN_TEMP_JOURNAL));
|
100
|
+
rb_define_const(mSqlite3Open, "SUBJOURNAL", INT2FIX(SQLITE_OPEN_SUBJOURNAL));
|
101
|
+
rb_define_const(mSqlite3Open, "MASTER_JOURNAL", INT2FIX(SQLITE_OPEN_MASTER_JOURNAL));
|
102
|
+
rb_define_const(mSqlite3Open, "NOMUTEX", INT2FIX(SQLITE_OPEN_NOMUTEX));
|
103
|
+
rb_define_const(mSqlite3Open, "FULLMUTEX", INT2FIX(SQLITE_OPEN_FULLMUTEX));
|
104
|
+
#ifdef SQLITE_OPEN_AUTOPROXY
|
105
|
+
/* SQLITE_VERSION_NUMBER>=3007002 */
|
106
|
+
rb_define_const(mSqlite3Open, "AUTOPROXY", INT2FIX(SQLITE_OPEN_AUTOPROXY));
|
107
|
+
rb_define_const(mSqlite3Open, "SHAREDCACHE", INT2FIX(SQLITE_OPEN_SHAREDCACHE));
|
108
|
+
rb_define_const(mSqlite3Open, "PRIVATECACHE", INT2FIX(SQLITE_OPEN_PRIVATECACHE));
|
109
|
+
rb_define_const(mSqlite3Open, "WAL", INT2FIX(SQLITE_OPEN_WAL));
|
110
|
+
#endif
|
111
|
+
#ifdef SQLITE_OPEN_URI
|
112
|
+
/* SQLITE_VERSION_NUMBER>=3007007 */
|
113
|
+
rb_define_const(mSqlite3Open, "URI", INT2FIX(SQLITE_OPEN_URI));
|
114
|
+
#endif
|
115
|
+
#ifdef SQLITE_OPEN_MEMORY
|
116
|
+
/* SQLITE_VERSION_NUMBER>=3007013 */
|
117
|
+
rb_define_const(mSqlite3Open, "MEMORY", INT2FIX(SQLITE_OPEN_MEMORY));
|
118
|
+
#endif
|
119
|
+
}
|
120
|
+
|
121
|
+
void Init_sqlite3_native()
|
122
|
+
{
|
123
|
+
/*
|
124
|
+
* SQLite3 is a wrapper around the popular database
|
125
|
+
* sqlite[http://sqlite.org].
|
126
|
+
*
|
127
|
+
* For an example of usage, see SQLite3::Database.
|
128
|
+
*/
|
129
|
+
mSqlite3 = rb_define_module("SQLite3");
|
130
|
+
|
131
|
+
/* A class for differentiating between strings and blobs, when binding them
|
132
|
+
* into statements.
|
133
|
+
*/
|
134
|
+
cSqlite3Blob = rb_define_class_under(mSqlite3, "Blob", rb_cString);
|
135
|
+
|
136
|
+
/* Initialize the sqlite3 library */
|
137
|
+
#ifdef HAVE_SQLITE3_INITIALIZE
|
138
|
+
sqlite3_initialize();
|
139
|
+
#endif
|
140
|
+
|
141
|
+
init_sqlite3_constants();
|
142
|
+
init_sqlite3_database();
|
143
|
+
init_sqlite3_statement();
|
144
|
+
#ifdef HAVE_SQLITE3_BACKUP_INIT
|
145
|
+
init_sqlite3_backup();
|
146
|
+
#endif
|
147
|
+
|
148
|
+
rb_define_singleton_method(mSqlite3, "libversion", libversion, 0);
|
149
|
+
rb_define_singleton_method(mSqlite3, "threadsafe", threadsafe_p, 0);
|
150
|
+
rb_define_const(mSqlite3, "SQLITE_VERSION", rb_str_new2(SQLITE_VERSION));
|
151
|
+
rb_define_const(mSqlite3, "SQLITE_VERSION_NUMBER", INT2FIX(SQLITE_VERSION_NUMBER));
|
152
|
+
}
|
Binary file
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#ifndef SQLITE3_RUBY
|
2
|
+
#define SQLITE3_RUBY
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
|
6
|
+
#ifdef UNUSED
|
7
|
+
#elif defined(__GNUC__)
|
8
|
+
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
|
9
|
+
#elif defined(__LCLINT__)
|
10
|
+
# define UNUSED(x) /*@unused@*/ x
|
11
|
+
#else
|
12
|
+
# define UNUSED(x) x
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
16
|
+
#include <ruby/encoding.h>
|
17
|
+
|
18
|
+
#define USASCII_P(_obj) (rb_enc_get_index(_obj) == rb_usascii_encindex())
|
19
|
+
#define UTF8_P(_obj) (rb_enc_get_index(_obj) == rb_utf8_encindex())
|
20
|
+
#define UTF16_LE_P(_obj) (rb_enc_get_index(_obj) == rb_enc_find_index("UTF-16LE"))
|
21
|
+
#define UTF16_BE_P(_obj) (rb_enc_get_index(_obj) == rb_enc_find_index("UTF-16BE"))
|
22
|
+
#define SQLITE3_UTF8_STR_NEW2(_obj) \
|
23
|
+
(rb_enc_associate_index(rb_str_new2(_obj), rb_utf8_encindex()))
|
24
|
+
|
25
|
+
#else
|
26
|
+
|
27
|
+
#define SQLITE3_UTF8_STR_NEW2(_obj) (rb_str_new2(_obj))
|
28
|
+
|
29
|
+
#endif
|
30
|
+
|
31
|
+
|
32
|
+
#include <sqlite3.h>
|
33
|
+
|
34
|
+
#ifndef HAVE_TYPE_SQLITE3_INT64
|
35
|
+
typedef sqlite_int64 sqlite3_int64;
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#ifndef HAVE_TYPE_SQLITE3_UINT64
|
39
|
+
typedef sqlite_uint64 sqlite3_uint64;
|
40
|
+
#endif
|
41
|
+
|
42
|
+
extern VALUE mSqlite3;
|
43
|
+
extern VALUE cSqlite3Blob;
|
44
|
+
|
45
|
+
#include <database.h>
|
46
|
+
#include <statement.h>
|
47
|
+
#include <exception.h>
|
48
|
+
#include <backup.h>
|
49
|
+
|
50
|
+
int bignum_to_int64(VALUE big, sqlite3_int64 *result);
|
51
|
+
|
52
|
+
#endif
|