amalgalite 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/LICENSE +31 -0
- data/README +28 -0
- data/ext/amalgalite3.c +191 -0
- data/ext/amalgalite3.h +97 -0
- data/ext/amalgalite3_constants.c +179 -0
- data/ext/amalgalite3_database.c +458 -0
- data/ext/amalgalite3_statement.c +546 -0
- data/ext/gen_constants.rb +114 -0
- data/ext/mkrf_conf.rb +6 -0
- data/ext/sqlite3.c +87003 -0
- data/ext/sqlite3.h +5638 -0
- data/ext/sqlite3_options.h +4 -0
- data/ext/sqlite3ext.h +362 -0
- data/gemspec.rb +50 -0
- data/lib/amalgalite.rb +28 -0
- data/lib/amalgalite/blob.rb +14 -0
- data/lib/amalgalite/boolean.rb +42 -0
- data/lib/amalgalite/column.rb +83 -0
- data/lib/amalgalite/database.rb +505 -0
- data/lib/amalgalite/index.rb +27 -0
- data/lib/amalgalite/paths.rb +70 -0
- data/lib/amalgalite/profile_tap.rb +130 -0
- data/lib/amalgalite/schema.rb +90 -0
- data/lib/amalgalite/sqlite3.rb +4 -0
- data/lib/amalgalite/sqlite3/constants.rb +48 -0
- data/lib/amalgalite/sqlite3/version.rb +38 -0
- data/lib/amalgalite/statement.rb +307 -0
- data/lib/amalgalite/table.rb +34 -0
- data/lib/amalgalite/taps/console.rb +27 -0
- data/lib/amalgalite/taps/io.rb +71 -0
- data/lib/amalgalite/trace_tap.rb +35 -0
- data/lib/amalgalite/type_map.rb +60 -0
- data/lib/amalgalite/type_maps/default_map.rb +153 -0
- data/lib/amalgalite/type_maps/storage_map.rb +41 -0
- data/lib/amalgalite/type_maps/text_map.rb +23 -0
- data/lib/amalgalite/version.rb +32 -0
- data/lib/amalgalite/view.rb +24 -0
- data/spec/amalgalite_spec.rb +4 -0
- data/spec/boolean_spec.rb +26 -0
- data/spec/database_spec.rb +222 -0
- data/spec/default_map_spec.rb +85 -0
- data/spec/integeration_spec.rb +111 -0
- data/spec/paths_spec.rb +28 -0
- data/spec/schema_spec.rb +46 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/sqlite3/constants_spec.rb +25 -0
- data/spec/sqlite3/version_spec.rb +14 -0
- data/spec/sqlite3_spec.rb +34 -0
- data/spec/statement_spec.rb +116 -0
- data/spec/storage_map_spec.rb +41 -0
- data/spec/tap_spec.rb +59 -0
- data/spec/text_map_spec.rb +23 -0
- data/spec/type_map_spec.rb +17 -0
- data/spec/version_spec.rb +9 -0
- data/tasks/announce.rake +38 -0
- data/tasks/config.rb +108 -0
- data/tasks/distribution.rake +38 -0
- data/tasks/documentation.rake +31 -0
- data/tasks/extension.rake +45 -0
- data/tasks/rspec.rake +32 -0
- data/tasks/rubyforge.rake +48 -0
- data/tasks/utils.rb +80 -0
- metadata +165 -0
data/HISTORY
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Copyright (c) 2008, Jeremy Hinegardner
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the
|
13
|
+
documentation and/or other materials provided with the
|
14
|
+
distribution.
|
15
|
+
|
16
|
+
* Neither the name of Jeremy Hinegardner nor the
|
17
|
+
names of its contributors may be used to endorse or promote
|
18
|
+
products derived from this software without specific prior written
|
19
|
+
permission.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
22
|
+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
23
|
+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
24
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
25
|
+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
26
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
27
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== Amalgalite
|
2
|
+
|
3
|
+
* Homepage[http://www.copiousfreetime.org/projects/amalgalite]
|
4
|
+
* {Rubyforge Project}[http://rubyforge.org/projects/copiousfreetime/]
|
5
|
+
* email jeremy at copiousfreetime dot org
|
6
|
+
|
7
|
+
== INSTALL
|
8
|
+
|
9
|
+
* gem install amalgalite
|
10
|
+
|
11
|
+
== DESCRIPTION
|
12
|
+
|
13
|
+
Amalgalite embeds the SQLite database engine in a ruby extension.
|
14
|
+
|
15
|
+
Scroll through Amalgalite::Database for a quick example, and a general overview
|
16
|
+
of the API.
|
17
|
+
|
18
|
+
== CREDITS
|
19
|
+
|
20
|
+
* Jamis Buck for the first {ruby sqlite implementation}[http://www.rubyforge.org/projects/sqlite-ruby]
|
21
|
+
|
22
|
+
== LICENSE
|
23
|
+
|
24
|
+
Copyright (c) 2008 Jeremy Hinegardner
|
25
|
+
|
26
|
+
All rights reserved.
|
27
|
+
|
28
|
+
See LICENSE and/or COPYING for details.
|
data/ext/amalgalite3.c
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2008 Jeremy Hinegardner
|
3
|
+
* All rights reserved. See LICENSE and/or COPYING for details.
|
4
|
+
*
|
5
|
+
* vim: shiftwidth=4
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "amalgalite3.h"
|
9
|
+
|
10
|
+
/* Module and Classes */
|
11
|
+
VALUE mA; /* module Amalgalite */
|
12
|
+
VALUE mAS; /* module Amalgalite::SQLite3 */
|
13
|
+
VALUE mASV; /* module Amalgalite::SQLite3::Version */
|
14
|
+
VALUE eAS_Error; /* class Amalgalite::SQLite3::Error */
|
15
|
+
|
16
|
+
/*----------------------------------------------------------------------
|
17
|
+
* module methods for Amalgalite::SQLite3
|
18
|
+
*---------------------------------------------------------------------*/
|
19
|
+
|
20
|
+
/*
|
21
|
+
* call-seq:
|
22
|
+
* Amalgalite::SQLite3.threadsafe? -> true or false
|
23
|
+
*
|
24
|
+
* Has the SQLite3 extension been compiled "threadsafe". If threadsafe? is
|
25
|
+
* true then the internal SQLite mutexes are enabled and SQLite is threadsafe.
|
26
|
+
* That is threadsafe within the context of 'C' threads.
|
27
|
+
*
|
28
|
+
*/
|
29
|
+
VALUE am_sqlite3_threadsafe(VALUE self)
|
30
|
+
{
|
31
|
+
if (sqlite3_threadsafe()) {
|
32
|
+
return Qtrue;
|
33
|
+
} else {
|
34
|
+
return Qfalse;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
/*
|
39
|
+
* call-seq:
|
40
|
+
* Amalgalite::SQLite3.complete?( ... , opts = { :utf16 => false }) -> True, False
|
41
|
+
*
|
42
|
+
* Is the text passed in as a parameter a complete SQL statement? Or is
|
43
|
+
* additional input required before sending the SQL to the extension. If the
|
44
|
+
* extra 'opts' parameter is used, you can send in a UTF-16 encoded string as
|
45
|
+
* the SQL.
|
46
|
+
*
|
47
|
+
* A complete statement must end with a semicolon.
|
48
|
+
*
|
49
|
+
*/
|
50
|
+
VALUE am_sqlite3_complete(VALUE self, VALUE args)
|
51
|
+
{
|
52
|
+
VALUE sql = rb_ary_shift( args );
|
53
|
+
VALUE opts = rb_ary_shift( args );
|
54
|
+
VALUE utf16 = Qnil;
|
55
|
+
int result = 0;
|
56
|
+
|
57
|
+
if ( ( Qnil != opts ) && ( T_HASH == TYPE(opts) ) ){
|
58
|
+
utf16 = rb_hash_aref( opts, rb_intern("utf16") );
|
59
|
+
}
|
60
|
+
|
61
|
+
if ( (Qfalse == utf16) || (Qnil == utf16) ) {
|
62
|
+
result = sqlite3_complete( StringValuePtr( sql ) );
|
63
|
+
} else {
|
64
|
+
result = sqlite3_complete16( (void*) StringValuePtr( sql ) );
|
65
|
+
}
|
66
|
+
|
67
|
+
return ( result > 0 ) ? Qtrue : Qfalse;
|
68
|
+
}
|
69
|
+
|
70
|
+
/*
|
71
|
+
* call-seq:
|
72
|
+
* Amalgalite::SQLite3.memory_used -> Numeric
|
73
|
+
*
|
74
|
+
* Return the number of bytes of memory outstanding in the SQLite extension
|
75
|
+
*/
|
76
|
+
VALUE am_sqlite3_memory_used(VALUE self)
|
77
|
+
{
|
78
|
+
return SQLINT64_2NUM(sqlite3_memory_used());
|
79
|
+
}
|
80
|
+
|
81
|
+
/*
|
82
|
+
* call-seq:
|
83
|
+
* Amalgalite::SQLite3.memory_highwater_mark -> Numeric
|
84
|
+
*
|
85
|
+
* Return the maximum value of Amalgalite::SQLite3.memory_used since the last
|
86
|
+
* time the highwater mark was reset.
|
87
|
+
*
|
88
|
+
*/
|
89
|
+
VALUE am_sqlite3_memory_highwater(VALUE self)
|
90
|
+
{
|
91
|
+
return SQLINT64_2NUM(sqlite3_memory_highwater(0));
|
92
|
+
}
|
93
|
+
|
94
|
+
/*
|
95
|
+
* call-seq:
|
96
|
+
* Amalgalite::SQLite3.memory_highwater_mark_reset!
|
97
|
+
*
|
98
|
+
* Reset the memory highwater mark. The highwater mark becomes the current
|
99
|
+
* value of memory_used.
|
100
|
+
*
|
101
|
+
*/
|
102
|
+
VALUE am_sqlite3_memory_highwater_reset(VALUE self)
|
103
|
+
{
|
104
|
+
return SQLINT64_2NUM(sqlite3_memory_highwater(1));
|
105
|
+
}
|
106
|
+
|
107
|
+
/*
|
108
|
+
* call-seq:
|
109
|
+
* Amalgalite::SQLite3.randomness( N ) -> String of length N
|
110
|
+
*
|
111
|
+
* Generate N bytes of random data.
|
112
|
+
*
|
113
|
+
*/
|
114
|
+
VALUE am_sqlite3_randomness(VALUE self, VALUE num_bytes)
|
115
|
+
{
|
116
|
+
int n = NUM2INT(num_bytes);
|
117
|
+
char *buf = ALLOCA_N(char, n);
|
118
|
+
|
119
|
+
sqlite3_randomness( n, buf );
|
120
|
+
return rb_str_new( buf, n );
|
121
|
+
}
|
122
|
+
|
123
|
+
/*----------------------------------------------------------------------
|
124
|
+
* module methods for Amalgalite::SQLite3::Version
|
125
|
+
*---------------------------------------------------------------------*/
|
126
|
+
|
127
|
+
/*
|
128
|
+
* call-seq:
|
129
|
+
* Amalgalite::SQLite3::Version.to_s -> String
|
130
|
+
*
|
131
|
+
* Return the SQLite C library version number as a string
|
132
|
+
*
|
133
|
+
*/
|
134
|
+
VALUE am_sqlite3_libversion(VALUE self)
|
135
|
+
{
|
136
|
+
return rb_str_new2(sqlite3_libversion());
|
137
|
+
}
|
138
|
+
|
139
|
+
/*
|
140
|
+
* call-seq:
|
141
|
+
* Amalgalite::SQLite3.Version.to_i -> Fixnum
|
142
|
+
*
|
143
|
+
* Return the SQLite C library version number as an integer
|
144
|
+
*
|
145
|
+
*/
|
146
|
+
VALUE am_sqlite3_libversion_number(VALUE self)
|
147
|
+
{
|
148
|
+
return INT2FIX(sqlite3_libversion_number());
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
void Init_amalgalite3()
|
153
|
+
{
|
154
|
+
/*
|
155
|
+
* top level module encapsulating the entire Amalgalite library
|
156
|
+
*/
|
157
|
+
mA = rb_define_module("Amalgalite");
|
158
|
+
|
159
|
+
/*
|
160
|
+
* module encapsulating the SQLite C extension
|
161
|
+
*/
|
162
|
+
mAS = rb_define_module_under(mA, "SQLite3");
|
163
|
+
rb_define_module_function(mAS, "threadsafe?", am_sqlite3_threadsafe, 0);
|
164
|
+
rb_define_module_function(mAS, "complete?", am_sqlite3_complete, -2);
|
165
|
+
rb_define_module_function(mAS, "memory_used", am_sqlite3_memory_used,0);
|
166
|
+
rb_define_module_function(mAS, "memory_highwater_mark", am_sqlite3_memory_highwater,0);
|
167
|
+
rb_define_module_function(mAS, "memory_highwater_mark_reset!", am_sqlite3_memory_highwater_reset,0);
|
168
|
+
rb_define_module_function(mAS, "randomness", am_sqlite3_randomness,1);
|
169
|
+
|
170
|
+
/*
|
171
|
+
* Base class of all SQLite3 errors
|
172
|
+
*/
|
173
|
+
eAS_Error = rb_define_class_under(mAS, "Error", rb_eStandardError);
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Encapsulation of the SQLite C library version
|
177
|
+
*/
|
178
|
+
mASV = rb_define_module_under(mAS, "Version");
|
179
|
+
rb_define_module_function(mASV, "to_s", am_sqlite3_libversion, 0); /* in amalgalite3.c */
|
180
|
+
rb_define_module_function(mASV, "to_i", am_sqlite3_libversion_number, 0); /* in amalgalite3.c */
|
181
|
+
|
182
|
+
/*
|
183
|
+
* Initialize the rest of the module
|
184
|
+
*/
|
185
|
+
Init_amalgalite3_constants( );
|
186
|
+
Init_amalgalite3_database( );
|
187
|
+
Init_amalgalite3_statement( );
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
data/ext/amalgalite3.h
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2008 Jeremy Hinegardner
|
3
|
+
* All rights reserved. See LICENSE and/or COPYING for details.
|
4
|
+
*
|
5
|
+
* vim: shiftwidth=4
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __AMALGALITE_H__
|
9
|
+
#define __AMALGALITE_H__
|
10
|
+
|
11
|
+
#include "ruby.h"
|
12
|
+
#include "sqlite3.h"
|
13
|
+
|
14
|
+
/* wrapper struct around the sqlite3 opaque pointer */
|
15
|
+
typedef struct am_sqlite3 {
|
16
|
+
sqlite3 *db;
|
17
|
+
VALUE trace_obj;
|
18
|
+
VALUE profile_obj;
|
19
|
+
} am_sqlite3;
|
20
|
+
|
21
|
+
/* wrapper struct around the sqlite3_statement opaque pointer */
|
22
|
+
typedef struct am_sqlite3_stmt {
|
23
|
+
sqlite3_stmt *stmt;
|
24
|
+
VALUE remaining_sql;
|
25
|
+
} am_sqlite3_stmt;
|
26
|
+
|
27
|
+
|
28
|
+
/** module and classes **/
|
29
|
+
extern VALUE mA; /* module Amalgalite */
|
30
|
+
extern VALUE mAS; /* module Amalgalite::SQLite3 */
|
31
|
+
extern VALUE mASV; /* module Amalgalite::SQLite3::Version */
|
32
|
+
extern VALUE eAS_Error; /* class Amalgalite::SQLite3::Error */
|
33
|
+
|
34
|
+
/*----------------------------------------------------------------------
|
35
|
+
* Prototype for Amalgalite::SQLite3::Database
|
36
|
+
*---------------------------------------------------------------------*/
|
37
|
+
extern VALUE cAS_Database; /* class Amalgliate::SQLite3::Database */
|
38
|
+
|
39
|
+
extern void am_define_constants_under(VALUE);
|
40
|
+
extern VALUE am_sqlite3_database_alloc(VALUE klass);
|
41
|
+
extern void am_sqlite3_database_free(am_sqlite3*);
|
42
|
+
extern VALUE am_sqlite3_database_open(int argc, VALUE* argv, VALUE self);
|
43
|
+
extern VALUE am_sqlite3_database_close(VALUE self);
|
44
|
+
extern VALUE am_sqlite3_database_open16(VALUE self, VALUE rFilename);
|
45
|
+
extern VALUE am_sqlite3_database_last_insert_rowid(VALUE self);
|
46
|
+
extern VALUE am_sqlite3_database_is_autocommit(VALUE self);
|
47
|
+
extern VALUE am_sqlite3_database_row_changes(VALUE self);
|
48
|
+
extern VALUE am_sqlite3_database_total_changes(VALUE self);
|
49
|
+
extern VALUE am_sqlite3_database_table_column_metadata(VALUE self, VALUE db_name, VALUE tbl_name, VALUE col_name);
|
50
|
+
|
51
|
+
extern VALUE am_sqlite3_database_prepare(VALUE self, VALUE rSQL);
|
52
|
+
extern VALUE am_sqlite3_database_register_trace_tap(VALUE self, VALUE tap);
|
53
|
+
extern VALUE am_sqlite3_database_register_profile_tap(VALUE self, VALUE tap);
|
54
|
+
|
55
|
+
/*----------------------------------------------------------------------
|
56
|
+
* Prototype for Amalgalite::SQLite3::Statement
|
57
|
+
*---------------------------------------------------------------------*/
|
58
|
+
extern VALUE cAS_Statement; /* class Amalgliate::SQLite3::Statement */
|
59
|
+
|
60
|
+
extern VALUE am_sqlite3_statement_alloc(VALUE klass);
|
61
|
+
extern void am_sqlite3_statement_free(am_sqlite3_stmt* );
|
62
|
+
extern VALUE am_sqlite3_statement_sql(VALUE self);
|
63
|
+
extern VALUE am_sqlite3_statement_close(VALUE self);
|
64
|
+
extern VALUE am_sqlite3_statement_step(VALUE self);
|
65
|
+
extern VALUE am_sqlite3_statement_column_count(VALUE self);
|
66
|
+
extern VALUE am_sqlite3_statement_column_name(VALUE self, VALUE index);
|
67
|
+
extern VALUE am_sqlite3_statement_column_decltype(VALUE self, VALUE index);
|
68
|
+
extern VALUE am_sqlite3_statement_column_type(VALUE self, VALUE index);
|
69
|
+
extern VALUE am_sqlite3_statement_column_text(VALUE self, VALUE index);
|
70
|
+
extern VALUE am_sqlite3_statement_column_int(VALUE self, VALUE index);
|
71
|
+
extern VALUE am_sqlite3_statement_column_int64(VALUE self, VALUE index);
|
72
|
+
extern VALUE am_sqlite3_statement_column_double(VALUE self, VALUE index);
|
73
|
+
|
74
|
+
extern VALUE am_sqlite3_statement_column_database_name(VALUE self, VALUE position);
|
75
|
+
extern VALUE am_sqlite3_statement_column_table_name(VALUE self, VALUE position);
|
76
|
+
extern VALUE am_sqlite3_statement_column_origin_name(VALUE self, VALUE position);
|
77
|
+
|
78
|
+
extern VALUE am_sqlite3_statement_reset(VALUE self);
|
79
|
+
extern VALUE am_sqlite3_statement_clear_bindings(VALUE self);
|
80
|
+
extern VALUE am_sqlite3_statement_bind_parameter_count(VALUE self);
|
81
|
+
extern VALUE am_sqlite3_statement_bind_parameter_index(VALUE self, VALUE parameter_name);
|
82
|
+
extern VALUE am_sqlite3_statement_remaining_sql(VALUE self);
|
83
|
+
extern VALUE am_sqlite3_statement_bind_text(VALUE self, VALUE position, VALUE value);
|
84
|
+
extern VALUE am_sqlite3_statement_bind_int(VALUE self, VALUE position, VALUE value);
|
85
|
+
extern VALUE am_sqlite3_statement_bind_int64(VALUE self, VALUE position, VALUE value);
|
86
|
+
extern VALUE am_sqlite3_statement_bind_double(VALUE self, VALUE position, VALUE value);
|
87
|
+
extern VALUE am_sqlite3_statement_bind_null(VALUE self, VALUE position);
|
88
|
+
|
89
|
+
/***********************************************************************
|
90
|
+
* Type conversion macros between sqlite data types and ruby types
|
91
|
+
**********************************************************************/
|
92
|
+
|
93
|
+
#define SQLINT64_2NUM(x) ( LL2NUM( x ) )
|
94
|
+
#define SQLUINT64_2NUM(x) ( ULL2NUM( x ) )
|
95
|
+
#define NUM2SQLINT64( obj ) ( NUM2LL( obj ) )
|
96
|
+
#define NUM2SQLUINT64( obj ) ( NUM2ULL( obj ) )
|
97
|
+
#endif
|
@@ -0,0 +1,179 @@
|
|
1
|
+
/* Generated by gen_constants.rb -- do not edit */
|
2
|
+
|
3
|
+
#include "amalgalite3.h";
|
4
|
+
void Init_amalgalite3_constants( )
|
5
|
+
{
|
6
|
+
/** :stopdoc:
|
7
|
+
* These calls are here just to allow for rdoc generation
|
8
|
+
* :startdoc:
|
9
|
+
*/
|
10
|
+
VALUE ma = rb_define_module("Amalgalite");
|
11
|
+
VALUE mas = rb_define_module_under(ma, "SQLite3");
|
12
|
+
|
13
|
+
/*
|
14
|
+
* module encapsulating all the SQLite C extension constants
|
15
|
+
*/
|
16
|
+
VALUE mC = rb_define_module_under( mas, "Constants");
|
17
|
+
/**
|
18
|
+
* module encapsulating the SQLite3 C extension constants for DataType
|
19
|
+
*/
|
20
|
+
VALUE mC_DataType = rb_define_module_under(mC, "DataType");
|
21
|
+
|
22
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
23
|
+
rb_define_const(mC_DataType, "BLOB", INT2FIX(SQLITE_BLOB));
|
24
|
+
|
25
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
26
|
+
rb_define_const(mC_DataType, "FLOAT", INT2FIX(SQLITE_FLOAT));
|
27
|
+
|
28
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
29
|
+
rb_define_const(mC_DataType, "INTEGER", INT2FIX(SQLITE_INTEGER));
|
30
|
+
|
31
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
32
|
+
rb_define_const(mC_DataType, "NULL", INT2FIX(SQLITE_NULL));
|
33
|
+
|
34
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
35
|
+
rb_define_const(mC_DataType, "TEXT", INT2FIX(SQLITE_TEXT));
|
36
|
+
|
37
|
+
/**
|
38
|
+
* module encapsulating the SQLite3 C extension constants for Open
|
39
|
+
*/
|
40
|
+
VALUE mC_Open = rb_define_module_under(mC, "Open");
|
41
|
+
|
42
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
43
|
+
rb_define_const(mC_Open, "CREATE", INT2FIX(SQLITE_OPEN_CREATE));
|
44
|
+
|
45
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
46
|
+
rb_define_const(mC_Open, "READONLY", INT2FIX(SQLITE_OPEN_READONLY));
|
47
|
+
|
48
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
49
|
+
rb_define_const(mC_Open, "READWRITE", INT2FIX(SQLITE_OPEN_READWRITE));
|
50
|
+
|
51
|
+
/**
|
52
|
+
* module encapsulating the SQLite3 C extension constants for ResultCode
|
53
|
+
*/
|
54
|
+
VALUE mC_ResultCode = rb_define_module_under(mC, "ResultCode");
|
55
|
+
|
56
|
+
/* 4 -- Callback routine requested an abort */
|
57
|
+
rb_define_const(mC_ResultCode, "ABORT", INT2FIX(SQLITE_ABORT));
|
58
|
+
|
59
|
+
/* 23 -- Authorization denied */
|
60
|
+
rb_define_const(mC_ResultCode, "AUTH", INT2FIX(SQLITE_AUTH));
|
61
|
+
|
62
|
+
/* 5 -- The database file is locked */
|
63
|
+
rb_define_const(mC_ResultCode, "BUSY", INT2FIX(SQLITE_BUSY));
|
64
|
+
|
65
|
+
/* 14 -- Unable to open the database file */
|
66
|
+
rb_define_const(mC_ResultCode, "CANTOPEN", INT2FIX(SQLITE_CANTOPEN));
|
67
|
+
|
68
|
+
/* 19 -- Abort due to constraint violation */
|
69
|
+
rb_define_const(mC_ResultCode, "CONSTRAINT", INT2FIX(SQLITE_CONSTRAINT));
|
70
|
+
|
71
|
+
/* 11 -- The database disk image is malformed */
|
72
|
+
rb_define_const(mC_ResultCode, "CORRUPT", INT2FIX(SQLITE_CORRUPT));
|
73
|
+
|
74
|
+
/* 101 -- sqlite3_step() has finished executing */
|
75
|
+
rb_define_const(mC_ResultCode, "DONE", INT2FIX(SQLITE_DONE));
|
76
|
+
|
77
|
+
/* 16 -- Database is empty */
|
78
|
+
rb_define_const(mC_ResultCode, "EMPTY", INT2FIX(SQLITE_EMPTY));
|
79
|
+
|
80
|
+
/* 1 -- SQL error or missing database */
|
81
|
+
rb_define_const(mC_ResultCode, "ERROR", INT2FIX(SQLITE_ERROR));
|
82
|
+
|
83
|
+
/* 24 -- Auxiliary database format error */
|
84
|
+
rb_define_const(mC_ResultCode, "FORMAT", INT2FIX(SQLITE_FORMAT));
|
85
|
+
|
86
|
+
/* 13 -- Insertion failed because database is full */
|
87
|
+
rb_define_const(mC_ResultCode, "FULL", INT2FIX(SQLITE_FULL));
|
88
|
+
|
89
|
+
/* 2 -- Internal logic error in SQLite */
|
90
|
+
rb_define_const(mC_ResultCode, "INTERNAL", INT2FIX(SQLITE_INTERNAL));
|
91
|
+
|
92
|
+
/* 9 -- Operation terminated by sqlite3_interrupt() */
|
93
|
+
rb_define_const(mC_ResultCode, "INTERRUPT", INT2FIX(SQLITE_INTERRUPT));
|
94
|
+
|
95
|
+
/* 10 -- Some kind of disk I/O error occurred */
|
96
|
+
rb_define_const(mC_ResultCode, "IOERR", INT2FIX(SQLITE_IOERR));
|
97
|
+
|
98
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
99
|
+
rb_define_const(mC_ResultCode, "IOERR_BLOCKED", INT2FIX(SQLITE_IOERR_BLOCKED));
|
100
|
+
|
101
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
102
|
+
rb_define_const(mC_ResultCode, "IOERR_DELETE", INT2FIX(SQLITE_IOERR_DELETE));
|
103
|
+
|
104
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
105
|
+
rb_define_const(mC_ResultCode, "IOERR_DIR_FSYNC", INT2FIX(SQLITE_IOERR_DIR_FSYNC));
|
106
|
+
|
107
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
108
|
+
rb_define_const(mC_ResultCode, "IOERR_FSTAT", INT2FIX(SQLITE_IOERR_FSTAT));
|
109
|
+
|
110
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
111
|
+
rb_define_const(mC_ResultCode, "IOERR_FSYNC", INT2FIX(SQLITE_IOERR_FSYNC));
|
112
|
+
|
113
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
114
|
+
rb_define_const(mC_ResultCode, "IOERR_NOMEM", INT2FIX(SQLITE_IOERR_NOMEM));
|
115
|
+
|
116
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
117
|
+
rb_define_const(mC_ResultCode, "IOERR_RDLOCK", INT2FIX(SQLITE_IOERR_RDLOCK));
|
118
|
+
|
119
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
120
|
+
rb_define_const(mC_ResultCode, "IOERR_READ", INT2FIX(SQLITE_IOERR_READ));
|
121
|
+
|
122
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
123
|
+
rb_define_const(mC_ResultCode, "IOERR_SHORT_READ", INT2FIX(SQLITE_IOERR_SHORT_READ));
|
124
|
+
|
125
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
126
|
+
rb_define_const(mC_ResultCode, "IOERR_TRUNCATE", INT2FIX(SQLITE_IOERR_TRUNCATE));
|
127
|
+
|
128
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
129
|
+
rb_define_const(mC_ResultCode, "IOERR_UNLOCK", INT2FIX(SQLITE_IOERR_UNLOCK));
|
130
|
+
|
131
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
132
|
+
rb_define_const(mC_ResultCode, "IOERR_WRITE", INT2FIX(SQLITE_IOERR_WRITE));
|
133
|
+
|
134
|
+
/* 6 -- A table in the database is locked */
|
135
|
+
rb_define_const(mC_ResultCode, "LOCKED", INT2FIX(SQLITE_LOCKED));
|
136
|
+
|
137
|
+
/* 20 -- Data type mismatch */
|
138
|
+
rb_define_const(mC_ResultCode, "MISMATCH", INT2FIX(SQLITE_MISMATCH));
|
139
|
+
|
140
|
+
/* 21 -- Library used incorrectly */
|
141
|
+
rb_define_const(mC_ResultCode, "MISUSE", INT2FIX(SQLITE_MISUSE));
|
142
|
+
|
143
|
+
/* 22 -- Uses OS features not supported on host */
|
144
|
+
rb_define_const(mC_ResultCode, "NOLFS", INT2FIX(SQLITE_NOLFS));
|
145
|
+
|
146
|
+
/* 7 -- A malloc() failed */
|
147
|
+
rb_define_const(mC_ResultCode, "NOMEM", INT2FIX(SQLITE_NOMEM));
|
148
|
+
|
149
|
+
/* 26 -- File opened that is not a database file */
|
150
|
+
rb_define_const(mC_ResultCode, "NOTADB", INT2FIX(SQLITE_NOTADB));
|
151
|
+
|
152
|
+
/* 12 -- NOT USED. Table or record not found */
|
153
|
+
rb_define_const(mC_ResultCode, "NOTFOUND", INT2FIX(SQLITE_NOTFOUND));
|
154
|
+
|
155
|
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
|
156
|
+
rb_define_const(mC_ResultCode, "OK", INT2FIX(SQLITE_OK));
|
157
|
+
|
158
|
+
/* 3 -- Access permission denied */
|
159
|
+
rb_define_const(mC_ResultCode, "PERM", INT2FIX(SQLITE_PERM));
|
160
|
+
|
161
|
+
/* 15 -- NOT USED. Database lock protocol error */
|
162
|
+
rb_define_const(mC_ResultCode, "PROTOCOL", INT2FIX(SQLITE_PROTOCOL));
|
163
|
+
|
164
|
+
/* 25 -- 2nd parameter to sqlite3_bind out of range */
|
165
|
+
rb_define_const(mC_ResultCode, "RANGE", INT2FIX(SQLITE_RANGE));
|
166
|
+
|
167
|
+
/* 8 -- Attempt to write a readonly database */
|
168
|
+
rb_define_const(mC_ResultCode, "READONLY", INT2FIX(SQLITE_READONLY));
|
169
|
+
|
170
|
+
/* 100 -- sqlite3_step() has another row ready */
|
171
|
+
rb_define_const(mC_ResultCode, "ROW", INT2FIX(SQLITE_ROW));
|
172
|
+
|
173
|
+
/* 17 -- The database schema changed */
|
174
|
+
rb_define_const(mC_ResultCode, "SCHEMA", INT2FIX(SQLITE_SCHEMA));
|
175
|
+
|
176
|
+
/* 18 -- String or BLOB exceeds size limit */
|
177
|
+
rb_define_const(mC_ResultCode, "TOOBIG", INT2FIX(SQLITE_TOOBIG));
|
178
|
+
|
179
|
+
}
|