amalgalite 1.1.2-x86-mswin32 → 1.3.0-x86-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +49 -0
- data/{HISTORY.rdoc → HISTORY.md} +96 -73
- data/LICENSE +2 -2
- data/Manifest.txt +104 -0
- data/README.md +73 -0
- data/Rakefile +25 -0
- data/TODO.md +50 -0
- data/ext/amalgalite/{amalgalite3.c → c/amalgalite.c} +12 -12
- data/ext/amalgalite/{amalgalite3.h → c/amalgalite.h} +5 -5
- data/ext/amalgalite/{amalgalite3_blob.c → c/amalgalite_blob.c} +2 -2
- data/ext/amalgalite/{amalgalite3_constants.c → c/amalgalite_constants.c} +2 -2
- data/ext/amalgalite/{amalgalite3_database.c → c/amalgalite_database.c} +49 -21
- data/ext/amalgalite/{amalgalite3_requires_bootstrap.c → c/amalgalite_requires_bootstrap.c} +131 -58
- data/ext/amalgalite/{amalgalite3_statement.c → c/amalgalite_statement.c} +2 -2
- data/ext/amalgalite/{extconf.rb → c/extconf.rb} +4 -4
- data/ext/amalgalite/{gen_constants.rb → c/gen_constants.rb} +3 -3
- data/ext/amalgalite/c/notes.txt +134 -0
- data/ext/amalgalite/{sqlite3.c → c/sqlite3.c} +94602 -80497
- data/ext/amalgalite/{sqlite3.h → c/sqlite3.h} +1047 -216
- data/ext/amalgalite/{sqlite3_options.h → c/sqlite3_options.h} +0 -0
- data/ext/amalgalite/{sqlite3ext.h → c/sqlite3ext.h} +40 -13
- data/lib/amalgalite.rb +13 -6
- data/lib/amalgalite/1.8/amalgalite.so +0 -0
- data/lib/amalgalite/1.9/amalgalite.so +0 -0
- data/lib/amalgalite/2.0/amalgalite.so +0 -0
- data/lib/amalgalite/column.rb +7 -5
- data/lib/amalgalite/database.rb +18 -10
- data/lib/amalgalite/packer.rb +5 -2
- data/lib/amalgalite/requires.rb +47 -16
- data/lib/amalgalite/schema.rb +63 -36
- data/lib/amalgalite/sqlite3/version.rb +0 -1
- data/lib/amalgalite/statement.rb +7 -5
- data/lib/amalgalite/table.rb +9 -8
- data/lib/amalgalite/type_maps/default_map.rb +0 -1
- data/lib/amalgalite/type_maps/storage_map.rb +0 -2
- data/lib/amalgalite/type_maps/text_map.rb +0 -1
- data/lib/amalgalite/version.rb +3 -32
- data/spec/aggregate_spec.rb +1 -1
- data/spec/amalgalite_spec.rb +1 -1
- data/spec/blob_spec.rb +1 -1
- data/spec/boolean_spec.rb +2 -1
- data/spec/busy_handler.rb +1 -1
- data/spec/database_spec.rb +16 -11
- data/spec/default_map_spec.rb +1 -1
- data/spec/function_spec.rb +1 -1
- data/spec/integeration_spec.rb +2 -1
- data/spec/packer_spec.rb +4 -4
- data/spec/paths_spec.rb +1 -1
- data/spec/progress_handler_spec.rb +4 -5
- data/spec/requires_spec.rb +36 -2
- data/spec/rtree_spec.rb +6 -5
- data/spec/schema_spec.rb +28 -20
- data/spec/spec_helper.rb +2 -7
- data/spec/sqlite3/constants_spec.rb +1 -1
- data/spec/sqlite3/database_status_spec.rb +4 -4
- data/spec/sqlite3/status_spec.rb +5 -5
- data/spec/sqlite3/version_spec.rb +7 -7
- data/spec/sqlite3_spec.rb +3 -3
- data/spec/statement_spec.rb +3 -4
- data/spec/storage_map_spec.rb +1 -1
- data/spec/tap_spec.rb +4 -4
- data/spec/text_map_spec.rb +1 -1
- data/spec/type_map_spec.rb +1 -1
- data/spec/version_spec.rb +2 -9
- data/tasks/custom.rake +99 -0
- data/tasks/default.rake +277 -0
- data/tasks/extension.rake +28 -202
- data/tasks/this.rb +209 -0
- metadata +102 -191
- data/README.rdoc +0 -54
- data/gemspec.rb +0 -63
- data/lib/amalgalite/1.8/amalgalite3.so +0 -0
- data/lib/amalgalite/1.9/amalgalite3.so +0 -0
- data/tasks/announce.rake +0 -44
- data/tasks/config.rb +0 -107
- data/tasks/distribution.rake +0 -77
- data/tasks/documentation.rake +0 -36
- data/tasks/rspec.rake +0 -30
- data/tasks/utils.rb +0 -80
data/Manifest.txt
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
CONTRIBUTING.md
|
2
|
+
HISTORY.md
|
3
|
+
LICENSE
|
4
|
+
Manifest.txt
|
5
|
+
README.md
|
6
|
+
Rakefile
|
7
|
+
TODO.md
|
8
|
+
bin/amalgalite-pack
|
9
|
+
examples/a.rb
|
10
|
+
examples/blob.rb
|
11
|
+
examples/bootstrap.rb
|
12
|
+
examples/define_aggregate.rb
|
13
|
+
examples/define_function.rb
|
14
|
+
examples/fts3.rb
|
15
|
+
examples/gem-db.rb
|
16
|
+
examples/require_me.rb
|
17
|
+
examples/requires.rb
|
18
|
+
examples/schema-info.rb
|
19
|
+
ext/amalgalite/c/amalgalite.c
|
20
|
+
ext/amalgalite/c/amalgalite.h
|
21
|
+
ext/amalgalite/c/amalgalite_blob.c
|
22
|
+
ext/amalgalite/c/amalgalite_constants.c
|
23
|
+
ext/amalgalite/c/amalgalite_database.c
|
24
|
+
ext/amalgalite/c/amalgalite_requires_bootstrap.c
|
25
|
+
ext/amalgalite/c/amalgalite_statement.c
|
26
|
+
ext/amalgalite/c/extconf.rb
|
27
|
+
ext/amalgalite/c/gen_constants.rb
|
28
|
+
ext/amalgalite/c/notes.txt
|
29
|
+
ext/amalgalite/c/sqlite3.c
|
30
|
+
ext/amalgalite/c/sqlite3.h
|
31
|
+
ext/amalgalite/c/sqlite3_options.h
|
32
|
+
ext/amalgalite/c/sqlite3ext.h
|
33
|
+
lib/amalgalite.rb
|
34
|
+
lib/amalgalite/aggregate.rb
|
35
|
+
lib/amalgalite/blob.rb
|
36
|
+
lib/amalgalite/boolean.rb
|
37
|
+
lib/amalgalite/busy_timeout.rb
|
38
|
+
lib/amalgalite/column.rb
|
39
|
+
lib/amalgalite/core_ext/kernel/require.rb
|
40
|
+
lib/amalgalite/csv_table_importer.rb
|
41
|
+
lib/amalgalite/database.rb
|
42
|
+
lib/amalgalite/function.rb
|
43
|
+
lib/amalgalite/index.rb
|
44
|
+
lib/amalgalite/memory_database.rb
|
45
|
+
lib/amalgalite/packer.rb
|
46
|
+
lib/amalgalite/paths.rb
|
47
|
+
lib/amalgalite/profile_tap.rb
|
48
|
+
lib/amalgalite/progress_handler.rb
|
49
|
+
lib/amalgalite/requires.rb
|
50
|
+
lib/amalgalite/schema.rb
|
51
|
+
lib/amalgalite/sqlite3.rb
|
52
|
+
lib/amalgalite/sqlite3/constants.rb
|
53
|
+
lib/amalgalite/sqlite3/database/function.rb
|
54
|
+
lib/amalgalite/sqlite3/database/status.rb
|
55
|
+
lib/amalgalite/sqlite3/status.rb
|
56
|
+
lib/amalgalite/sqlite3/version.rb
|
57
|
+
lib/amalgalite/statement.rb
|
58
|
+
lib/amalgalite/table.rb
|
59
|
+
lib/amalgalite/taps.rb
|
60
|
+
lib/amalgalite/taps/console.rb
|
61
|
+
lib/amalgalite/taps/io.rb
|
62
|
+
lib/amalgalite/trace_tap.rb
|
63
|
+
lib/amalgalite/type_map.rb
|
64
|
+
lib/amalgalite/type_maps/default_map.rb
|
65
|
+
lib/amalgalite/type_maps/storage_map.rb
|
66
|
+
lib/amalgalite/type_maps/text_map.rb
|
67
|
+
lib/amalgalite/version.rb
|
68
|
+
lib/amalgalite/view.rb
|
69
|
+
spec/aggregate_spec.rb
|
70
|
+
spec/amalgalite_spec.rb
|
71
|
+
spec/blob_spec.rb
|
72
|
+
spec/boolean_spec.rb
|
73
|
+
spec/busy_handler.rb
|
74
|
+
spec/data/iso-3166-country.txt
|
75
|
+
spec/data/iso-3166-schema.sql
|
76
|
+
spec/data/iso-3166-subcountry.txt
|
77
|
+
spec/data/make-iso-db.sh
|
78
|
+
spec/database_spec.rb
|
79
|
+
spec/default_map_spec.rb
|
80
|
+
spec/function_spec.rb
|
81
|
+
spec/integeration_spec.rb
|
82
|
+
spec/iso_3166_database.rb
|
83
|
+
spec/packer_spec.rb
|
84
|
+
spec/paths_spec.rb
|
85
|
+
spec/progress_handler_spec.rb
|
86
|
+
spec/requires_spec.rb
|
87
|
+
spec/rtree_spec.rb
|
88
|
+
spec/schema_spec.rb
|
89
|
+
spec/spec_helper.rb
|
90
|
+
spec/sqlite3/constants_spec.rb
|
91
|
+
spec/sqlite3/database_status_spec.rb
|
92
|
+
spec/sqlite3/status_spec.rb
|
93
|
+
spec/sqlite3/version_spec.rb
|
94
|
+
spec/sqlite3_spec.rb
|
95
|
+
spec/statement_spec.rb
|
96
|
+
spec/storage_map_spec.rb
|
97
|
+
spec/tap_spec.rb
|
98
|
+
spec/text_map_spec.rb
|
99
|
+
spec/type_map_spec.rb
|
100
|
+
spec/version_spec.rb
|
101
|
+
tasks/custom.rake
|
102
|
+
tasks/default.rake
|
103
|
+
tasks/extension.rake
|
104
|
+
tasks/this.rb
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
## Amalgalite
|
2
|
+
|
3
|
+
* [Homepage](http://github.com/copiousfreetime/amalgalite)
|
4
|
+
* email jeremy at copiousfreetime dot org
|
5
|
+
* `git clone git://github.com/copiousfreetime/amalgalite.git`
|
6
|
+
* [Github](http://github.com/copiousfreetime/amalgalite/)
|
7
|
+
* [Bug Tracking](http://github.com/copiousfreetime/amalgalite/issues)
|
8
|
+
|
9
|
+
## Articles
|
10
|
+
|
11
|
+
* [Writing SQL Functions in Ruby](http://copiousfreetime.org/articles/2009/01/10/writing-sql-functions-in-ruby.html)
|
12
|
+
|
13
|
+
## INSTALL
|
14
|
+
|
15
|
+
* `gem install amalgalite`
|
16
|
+
|
17
|
+
## DESCRIPTION
|
18
|
+
|
19
|
+
Amalgalite embeds the SQLite database engine in a ruby extension. There is no
|
20
|
+
need to install SQLite separately.
|
21
|
+
|
22
|
+
Look in the examples/ directory to see
|
23
|
+
|
24
|
+
* general usage
|
25
|
+
* blob io
|
26
|
+
* schema information
|
27
|
+
* custom functions
|
28
|
+
* custom aggregates
|
29
|
+
* requiring ruby code from a database
|
30
|
+
* full text search
|
31
|
+
|
32
|
+
Also Scroll through Amalgalite::Database for a quick example, and a general
|
33
|
+
overview of the API.
|
34
|
+
|
35
|
+
Amalgalite adds in the following additional non-default SQLite extensions:
|
36
|
+
|
37
|
+
* [R*Tree index extension](http://sqlite.org/rtree.html)
|
38
|
+
* [Full Text Search](http://sqlite.org/fts3.html)
|
39
|
+
|
40
|
+
## BUILDING FOR WINDOWS
|
41
|
+
|
42
|
+
[rake-compiler](https://github.com/luislavena/rake-compiler) is use for building
|
43
|
+
the windows version. For me, on OSX to cross compile the process is:
|
44
|
+
|
45
|
+
```
|
46
|
+
% gem install rake-compiler # in each rvm instance, 1.8.7, 1.9.3
|
47
|
+
% rvm use 2.0.0@amalgalite
|
48
|
+
% rake-compiler cross-ruby VERSION=2.0.0-p0 # or latest
|
49
|
+
% rvm use 1.9.3@amalgalite
|
50
|
+
% rake-compiler cross-ruby VERSION=1.9.3-p374 # or latest
|
51
|
+
% rvm use 1.8.7@amalgalite
|
52
|
+
% rake-compiler cross-ruby VERSION=1.8.7-p371
|
53
|
+
|
54
|
+
# This only works via 1.8.7 at the current moment
|
55
|
+
% rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
|
56
|
+
```
|
57
|
+
|
58
|
+
|
59
|
+
## CREDITS
|
60
|
+
|
61
|
+
* Jamis Buck for the first [ruby sqlite implementation](http://www.rubyforge.org/projects/sqlite-ruby)
|
62
|
+
|
63
|
+
## CHANGES
|
64
|
+
|
65
|
+
Read the HISTORY.rdoc file.
|
66
|
+
|
67
|
+
## LICENSE
|
68
|
+
|
69
|
+
Copyright (c) 2008 Jeremy Hinegardner
|
70
|
+
|
71
|
+
All rights reserved.
|
72
|
+
|
73
|
+
See LICENSE and/or COPYING for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# vim: syntax=ruby
|
2
|
+
load 'tasks/this.rb'
|
3
|
+
|
4
|
+
This.name = "amalgalite"
|
5
|
+
This.author = "Jeremy Hinegardner"
|
6
|
+
This.email = "jeremy@copiousfreetime.org"
|
7
|
+
This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
8
|
+
|
9
|
+
This.ruby_gemspec do |spec|
|
10
|
+
spec.add_dependency( 'arrayfields', '~> 4.7.4' )
|
11
|
+
spec.add_dependency( 'fastercsv' , '~> 1.5.5' )
|
12
|
+
|
13
|
+
spec.add_development_dependency( 'rspec' , '~> 2.13.0')
|
14
|
+
spec.add_development_dependency( 'rake' , '~> 10.0.3')
|
15
|
+
spec.add_development_dependency( 'rake-compiler', '~> 0.8.1' )
|
16
|
+
spec.add_development_dependency( 'rdoc' , '~> 4.0' )
|
17
|
+
spec.add_development_dependency( 'zip' , '~> 2.0.2' )
|
18
|
+
|
19
|
+
spec.extensions.concat This.extension_conf_files
|
20
|
+
spec.license = "BSD"
|
21
|
+
end
|
22
|
+
|
23
|
+
load 'tasks/default.rake'
|
24
|
+
load 'tasks/extension.rake'
|
25
|
+
load 'tasks/custom.rake'
|
data/TODO.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Future Release possibilties:
|
2
|
+
|
3
|
+
## SQLite API:
|
4
|
+
- authorizers
|
5
|
+
- loading of extensions
|
6
|
+
- utf-16 integration
|
7
|
+
- create_collation
|
8
|
+
- encryption key support
|
9
|
+
- expose sqlite3_strnicmp
|
10
|
+
- table name and column name in a type map?
|
11
|
+
- type conversion for manifest typing? how to allow it through?
|
12
|
+
- explicit pragma handler
|
13
|
+
|
14
|
+
## Non backwards compatible changes:
|
15
|
+
- change the schema objects to be more consistent
|
16
|
+
- change taps to use to_proc protocol
|
17
|
+
- convert type dependency to just use 'call'
|
18
|
+
- integrate transaction and savepoint under the same api
|
19
|
+
|
20
|
+
## SQLite Features:
|
21
|
+
- activate SQLITE_ENABLE_STAT2 option
|
22
|
+
- activate SQLITE_ENABLE_ICU extension
|
23
|
+
- activate SQLITE_ENABLE_LOCKING_STYLE
|
24
|
+
- activate SQLITE_ENABLE_UNLOCK_NOTIFY
|
25
|
+
- expose PRAGMA foreign_keys
|
26
|
+
- virtual file system
|
27
|
+
- full text search (FTS3)
|
28
|
+
- expose the sqlite mutex lib
|
29
|
+
- statement status ( sqlite3_stmt_status )
|
30
|
+
- db status ( sqlite3_db_status )
|
31
|
+
- library status ( sqlite3_status )
|
32
|
+
|
33
|
+
## Drivers:
|
34
|
+
- data mapper driver
|
35
|
+
- sequel driver optimization
|
36
|
+
|
37
|
+
## Features:
|
38
|
+
- Think about moving from arrayfields to ordered hash?
|
39
|
+
- add to command line which directory to pack into a rubylibs table
|
40
|
+
- amalgalite command line tool
|
41
|
+
- use ruby's ALLOC_N and hook into sqlite3_mem_methods
|
42
|
+
|
43
|
+
## Functions to possibly expose:
|
44
|
+
- sqlite3_backup_remaining, sqlite3_backup_pagecount
|
45
|
+
- sqlite3_compileoption_used, sqlite3_compileoption_get
|
46
|
+
- sqlite3_config
|
47
|
+
- sqlite3_data_count - returns number of colums in the result set of a
|
48
|
+
prepared statement
|
49
|
+
- sqlite_sourceid, sqlite_source_id
|
50
|
+
- sqlite3_strnicmp
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* vim: shiftwidth=4
|
6
6
|
:*/
|
7
7
|
|
8
|
-
#include "
|
8
|
+
#include "amalgalite.h"
|
9
9
|
|
10
10
|
/* Module and Classes */
|
11
11
|
VALUE mA; /* module Amalgalite */
|
@@ -266,7 +266,7 @@ VALUE am_sqlite3_compiled_version_number( VALUE self )
|
|
266
266
|
*
|
267
267
|
*/
|
268
268
|
|
269
|
-
void
|
269
|
+
void Init_amalgalite()
|
270
270
|
{
|
271
271
|
int rc = 0;
|
272
272
|
|
@@ -300,21 +300,21 @@ void Init_amalgalite3()
|
|
300
300
|
* Encapsulation of the SQLite C library version
|
301
301
|
*/
|
302
302
|
mASV = rb_define_module_under(mAS, "Version");
|
303
|
-
rb_define_module_function(mASV, "to_s", am_sqlite3_runtime_version, 0); /* in
|
303
|
+
rb_define_module_function(mASV, "to_s", am_sqlite3_runtime_version, 0); /* in amalgalite.c */
|
304
304
|
rb_define_module_function(mASV, "runtime_version", am_sqlite3_runtime_version, 0); /* in amalgalite.c */
|
305
|
-
rb_define_module_function(mASV, "to_i", am_sqlite3_runtime_version_number, 0); /* in
|
306
|
-
rb_define_module_function(mASV, "runtime_version_number", am_sqlite3_runtime_version_number, 0); /* in
|
307
|
-
rb_define_module_function(mASV, "compiled_version", am_sqlite3_compiled_version, 0 ); /* in
|
308
|
-
rb_define_module_function(mASV, "compiled_version_number", am_sqlite3_compiled_version_number, 0 ); /* in
|
305
|
+
rb_define_module_function(mASV, "to_i", am_sqlite3_runtime_version_number, 0); /* in amalgalite.c */
|
306
|
+
rb_define_module_function(mASV, "runtime_version_number", am_sqlite3_runtime_version_number, 0); /* in amalgalite.c */
|
307
|
+
rb_define_module_function(mASV, "compiled_version", am_sqlite3_compiled_version, 0 ); /* in amalgalite.c */
|
308
|
+
rb_define_module_function(mASV, "compiled_version_number", am_sqlite3_compiled_version_number, 0 ); /* in amalgalite.c */
|
309
309
|
|
310
310
|
/*
|
311
311
|
* Initialize the rest of the module
|
312
312
|
*/
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
313
|
+
Init_amalgalite_constants( );
|
314
|
+
Init_amalgalite_database( );
|
315
|
+
Init_amalgalite_statement( );
|
316
|
+
Init_amalgalite_blob( );
|
317
|
+
Init_amalgalite_requires_bootstrap( );
|
318
318
|
|
319
319
|
/*
|
320
320
|
* initialize sqlite itself
|
@@ -128,11 +128,11 @@ extern VALUE am_sqlite3_blob_length(VALUE self);
|
|
128
128
|
/*----------------------------------------------------------------------
|
129
129
|
* more initialization methods
|
130
130
|
*----------------------------------------------------------------------*/
|
131
|
-
extern void
|
132
|
-
extern void
|
133
|
-
extern void
|
134
|
-
extern void
|
135
|
-
extern void
|
131
|
+
extern void Init_amalgalite_constants( );
|
132
|
+
extern void Init_amalgalite_database( );
|
133
|
+
extern void Init_amalgalite_statement( );
|
134
|
+
extern void Init_amalgalite_blob( );
|
135
|
+
extern void Init_amalgalite_requires_bootstrap( );
|
136
136
|
|
137
137
|
|
138
138
|
/***********************************************************************
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "
|
1
|
+
#include "amalgalite.h"
|
2
2
|
/**
|
3
3
|
* Copyright (c) 2008 Jeremy Hinegardner
|
4
4
|
* All rights reserved. See LICENSE and/or COPYING for details.
|
@@ -219,7 +219,7 @@ VALUE am_sqlite3_blob_alloc(VALUE klass)
|
|
219
219
|
* incremental IO on a binary object, then you do not need to use Blob.
|
220
220
|
*/
|
221
221
|
|
222
|
-
void
|
222
|
+
void Init_amalgalite_blob( )
|
223
223
|
{
|
224
224
|
|
225
225
|
VALUE ma = rb_define_module("Amalgalite");
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/* Generated by gen_constants.rb -- do not edit */
|
2
2
|
|
3
|
-
#include "
|
3
|
+
#include "amalgalite.h"
|
4
4
|
/**
|
5
5
|
* Document-class: Amalgalite::SQLite3::Constants
|
6
6
|
*
|
7
7
|
* class holding constants in the sqlite extension
|
8
8
|
*/
|
9
|
-
void
|
9
|
+
void Init_amalgalite_constants( )
|
10
10
|
{
|
11
11
|
|
12
12
|
VALUE ma = rb_define_module("Amalgalite");
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "
|
1
|
+
#include "amalgalite.h"
|
2
2
|
/**
|
3
3
|
* Copyright (c) 2008 Jeremy Hinegardner
|
4
4
|
* All rights reserved. See LICENSE and/or COPYING for details.
|
@@ -300,6 +300,33 @@ VALUE am_sqlite3_database_prepare(VALUE self, VALUE rSQL)
|
|
300
300
|
return stmt;
|
301
301
|
}
|
302
302
|
|
303
|
+
|
304
|
+
/**
|
305
|
+
* call-seqL
|
306
|
+
* database.execute_batch( sqls ) -> Boolean
|
307
|
+
*
|
308
|
+
* Execute the statements in a batch.
|
309
|
+
*/
|
310
|
+
VALUE am_sqlite3_database_exec(VALUE self, VALUE rSQL)
|
311
|
+
{
|
312
|
+
VALUE sql = StringValue( rSQL );
|
313
|
+
am_sqlite3 *am_db;
|
314
|
+
int rc;
|
315
|
+
|
316
|
+
Data_Get_Struct(self, am_sqlite3, am_db);
|
317
|
+
|
318
|
+
rc = sqlite3_exec( am_db->db, RSTRING_PTR(sql), NULL, NULL, NULL );
|
319
|
+
|
320
|
+
if ( SQLITE_OK != rc ){
|
321
|
+
rb_raise( eAS_Error, "Failed to execute bulk statements: [SQLITE_ERROR %d] : %s\n",
|
322
|
+
rc, sqlite3_errmsg(am_db->db));
|
323
|
+
}
|
324
|
+
|
325
|
+
/* Presume that nobody will want to batch execute
|
326
|
+
more than a Fixnum's worth of statements */
|
327
|
+
return Qtrue;
|
328
|
+
}
|
329
|
+
|
303
330
|
/**
|
304
331
|
* This function is registered with a sqlite3 database using the sqlite3_trace
|
305
332
|
* function. During the registration process a handle on a VALUE is also
|
@@ -1104,7 +1131,7 @@ VALUE am_sqlite3_database_alloc(VALUE klass)
|
|
1104
1131
|
* The ruby extension wrapper around the core sqlite3 database object.
|
1105
1132
|
*
|
1106
1133
|
*/
|
1107
|
-
void
|
1134
|
+
void Init_amalgalite_database( )
|
1108
1135
|
{
|
1109
1136
|
|
1110
1137
|
VALUE ma = rb_define_module("Amalgalite");
|
@@ -1119,31 +1146,32 @@ void Init_amalgalite3_database( )
|
|
1119
1146
|
rb_define_singleton_method(cAS_Database, "open", am_sqlite3_database_open, -1);
|
1120
1147
|
rb_define_singleton_method(cAS_Database, "open16", am_sqlite3_database_open16, 1);
|
1121
1148
|
rb_define_method(cAS_Database, "prepare", am_sqlite3_database_prepare, 1);
|
1122
|
-
rb_define_method(cAS_Database, "close", am_sqlite3_database_close, 0); /* in
|
1123
|
-
rb_define_method(cAS_Database, "last_insert_rowid", am_sqlite3_database_last_insert_rowid, 0); /* in
|
1124
|
-
rb_define_method(cAS_Database, "autocommit?", am_sqlite3_database_is_autocommit, 0); /* in
|
1125
|
-
rb_define_method(cAS_Database, "register_trace_tap", am_sqlite3_database_register_trace_tap, 1); /* in
|
1126
|
-
rb_define_method(cAS_Database, "register_profile_tap", am_sqlite3_database_register_profile_tap, 1); /* in
|
1127
|
-
rb_define_method(cAS_Database, "table_column_metadata", am_sqlite3_database_table_column_metadata, 3); /* in
|
1128
|
-
rb_define_method(cAS_Database, "row_changes", am_sqlite3_database_row_changes, 0); /* in
|
1129
|
-
rb_define_method(cAS_Database, "total_changes", am_sqlite3_database_total_changes, 0); /* in
|
1130
|
-
rb_define_method(cAS_Database, "last_error_code", am_sqlite3_database_last_error_code, 0); /* in
|
1131
|
-
rb_define_method(cAS_Database, "last_error_message", am_sqlite3_database_last_error_message, 0); /* in
|
1132
|
-
rb_define_method(cAS_Database, "define_function", am_sqlite3_database_define_function, 2); /* in
|
1133
|
-
rb_define_method(cAS_Database, "remove_function", am_sqlite3_database_remove_function, 2); /* in
|
1134
|
-
rb_define_method(cAS_Database, "define_aggregate", am_sqlite3_database_define_aggregate, 3); /* in
|
1135
|
-
rb_define_method(cAS_Database, "remove_aggregate", am_sqlite3_database_remove_aggregate, 3); /* in
|
1136
|
-
rb_define_method(cAS_Database, "busy_handler", am_sqlite3_database_busy_handler, 1); /* in
|
1137
|
-
rb_define_method(cAS_Database, "progress_handler", am_sqlite3_database_progress_handler, 2); /* in
|
1138
|
-
rb_define_method(cAS_Database, "interrupt!", am_sqlite3_database_interrupt_bang, 0); /* in
|
1139
|
-
rb_define_method(cAS_Database, "replicate_to", am_sqlite3_database_replicate_to, 1); /* in
|
1149
|
+
rb_define_method(cAS_Database, "close", am_sqlite3_database_close, 0); /* in amalgalite_database.c */
|
1150
|
+
rb_define_method(cAS_Database, "last_insert_rowid", am_sqlite3_database_last_insert_rowid, 0); /* in amalgalite_database.c */
|
1151
|
+
rb_define_method(cAS_Database, "autocommit?", am_sqlite3_database_is_autocommit, 0); /* in amalgalite_database.c */
|
1152
|
+
rb_define_method(cAS_Database, "register_trace_tap", am_sqlite3_database_register_trace_tap, 1); /* in amalgalite_database.c */
|
1153
|
+
rb_define_method(cAS_Database, "register_profile_tap", am_sqlite3_database_register_profile_tap, 1); /* in amalgalite_database.c */
|
1154
|
+
rb_define_method(cAS_Database, "table_column_metadata", am_sqlite3_database_table_column_metadata, 3); /* in amalgalite_database.c */
|
1155
|
+
rb_define_method(cAS_Database, "row_changes", am_sqlite3_database_row_changes, 0); /* in amalgalite_database.c */
|
1156
|
+
rb_define_method(cAS_Database, "total_changes", am_sqlite3_database_total_changes, 0); /* in amalgalite_database.c */
|
1157
|
+
rb_define_method(cAS_Database, "last_error_code", am_sqlite3_database_last_error_code, 0); /* in amalgalite_database.c */
|
1158
|
+
rb_define_method(cAS_Database, "last_error_message", am_sqlite3_database_last_error_message, 0); /* in amalgalite_database.c */
|
1159
|
+
rb_define_method(cAS_Database, "define_function", am_sqlite3_database_define_function, 2); /* in amalgalite_database.c */
|
1160
|
+
rb_define_method(cAS_Database, "remove_function", am_sqlite3_database_remove_function, 2); /* in amalgalite_database.c */
|
1161
|
+
rb_define_method(cAS_Database, "define_aggregate", am_sqlite3_database_define_aggregate, 3); /* in amalgalite_database.c */
|
1162
|
+
rb_define_method(cAS_Database, "remove_aggregate", am_sqlite3_database_remove_aggregate, 3); /* in amalgalite_database.c */
|
1163
|
+
rb_define_method(cAS_Database, "busy_handler", am_sqlite3_database_busy_handler, 1); /* in amalgalite_database.c */
|
1164
|
+
rb_define_method(cAS_Database, "progress_handler", am_sqlite3_database_progress_handler, 2); /* in amalgalite_database.c */
|
1165
|
+
rb_define_method(cAS_Database, "interrupt!", am_sqlite3_database_interrupt_bang, 0); /* in amalgalite_database.c */
|
1166
|
+
rb_define_method(cAS_Database, "replicate_to", am_sqlite3_database_replicate_to, 1); /* in amalgalite_database.c */
|
1167
|
+
rb_define_method(cAS_Database, "execute_batch", am_sqlite3_database_exec, 1); /* in amalgalite_database.c */
|
1140
1168
|
|
1141
1169
|
|
1142
1170
|
/*
|
1143
1171
|
* Ecapuslate a SQLite3 Database stat
|
1144
1172
|
*/
|
1145
1173
|
cAS_Database_Stat = rb_define_class_under( cAS_Database, "Stat", rb_cObject );
|
1146
|
-
rb_define_method(cAS_Database_Stat, "update!", am_sqlite3_database_stat_update_bang, -1); /* in
|
1174
|
+
rb_define_method(cAS_Database_Stat, "update!", am_sqlite3_database_stat_update_bang, -1); /* in amalgalite_database.c */
|
1147
1175
|
|
1148
1176
|
}
|
1149
1177
|
|