sqlite3 1.5.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +390 -0
- data/CONTRIBUTING.md +34 -2
- data/{faq/faq.md → FAQ.md} +0 -43
- data/INSTALLATION.md +269 -0
- data/LICENSE +18 -22
- data/README.md +76 -128
- data/dependencies.yml +13 -0
- data/ext/sqlite3/aggregator.c +142 -146
- data/ext/sqlite3/aggregator.h +2 -4
- data/ext/sqlite3/backup.c +86 -64
- data/ext/sqlite3/backup.h +2 -2
- data/ext/sqlite3/database.c +543 -465
- data/ext/sqlite3/database.h +9 -4
- data/ext/sqlite3/exception.c +111 -92
- data/ext/sqlite3/exception.h +3 -1
- data/ext/sqlite3/extconf.rb +83 -51
- data/ext/sqlite3/sqlite3.c +160 -115
- data/ext/sqlite3/sqlite3_ruby.h +2 -2
- data/ext/sqlite3/statement.c +518 -293
- data/ext/sqlite3/statement.h +3 -3
- data/ext/sqlite3/timespec.h +20 -0
- data/lib/sqlite3/constants.rb +171 -47
- data/lib/sqlite3/database.rb +141 -181
- data/lib/sqlite3/errors.rb +26 -1
- data/lib/sqlite3/pragmas.rb +128 -138
- data/lib/sqlite3/resultset.rb +14 -105
- data/lib/sqlite3/statement.rb +58 -13
- data/lib/sqlite3/value.rb +17 -20
- data/lib/sqlite3/version.rb +1 -21
- data/lib/sqlite3.rb +6 -4
- data/ports/archives/sqlite-autoconf-3460000.tar.gz +0 -0
- metadata +19 -107
- data/API_CHANGES.md +0 -49
- data/ChangeLog.cvs +0 -88
- data/Gemfile +0 -3
- data/LICENSE-DEPENDENCIES +0 -20
- data/faq/faq.rb +0 -145
- data/faq/faq.yml +0 -426
- data/lib/sqlite3/translator.rb +0 -118
- data/ports/archives/sqlite-autoconf-3380500.tar.gz +0 -0
- data/test/helper.rb +0 -27
- data/test/test_backup.rb +0 -33
- data/test/test_collation.rb +0 -82
- data/test/test_database.rb +0 -545
- data/test/test_database_flags.rb +0 -95
- data/test/test_database_readonly.rb +0 -36
- data/test/test_database_readwrite.rb +0 -41
- data/test/test_deprecated.rb +0 -44
- data/test/test_encoding.rb +0 -155
- data/test/test_integration.rb +0 -507
- data/test/test_integration_aggregate.rb +0 -336
- data/test/test_integration_open_close.rb +0 -30
- data/test/test_integration_pending.rb +0 -115
- data/test/test_integration_resultset.rb +0 -142
- data/test/test_integration_statement.rb +0 -194
- data/test/test_result_set.rb +0 -37
- data/test/test_sqlite3.rb +0 -30
- data/test/test_statement.rb +0 -263
- data/test/test_statement_execute.rb +0 -35
data/ext/sqlite3/statement.h
CHANGED
@@ -4,12 +4,12 @@
|
|
4
4
|
#include <sqlite3_ruby.h>
|
5
5
|
|
6
6
|
struct _sqlite3StmtRuby {
|
7
|
-
|
8
|
-
|
7
|
+
sqlite3_stmt *st;
|
8
|
+
int done_p;
|
9
9
|
};
|
10
10
|
|
11
11
|
typedef struct _sqlite3StmtRuby sqlite3StmtRuby;
|
12
|
-
typedef sqlite3StmtRuby *
|
12
|
+
typedef sqlite3StmtRuby *sqlite3StmtRubyPtr;
|
13
13
|
|
14
14
|
void init_sqlite3_statement();
|
15
15
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#define timespecclear(tsp) (tsp)->tv_sec = (tsp)->tv_nsec = 0
|
2
|
+
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
|
3
|
+
#define timespecisvalid(tsp) \
|
4
|
+
((tsp)->tv_nsec >= 0 && (tsp)->tv_nsec < 1000000000L)
|
5
|
+
#define timespeccmp(tsp, usp, cmp) \
|
6
|
+
(((tsp)->tv_sec == (usp)->tv_sec) ? \
|
7
|
+
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
|
8
|
+
((tsp)->tv_sec cmp (usp)->tv_sec))
|
9
|
+
#define timespecsub(tsp, usp, vsp) \
|
10
|
+
do { \
|
11
|
+
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
|
12
|
+
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
|
13
|
+
if ((vsp)->tv_nsec < 0) { \
|
14
|
+
(vsp)->tv_sec--; \
|
15
|
+
(vsp)->tv_nsec += 1000000000L; \
|
16
|
+
} \
|
17
|
+
} while (0)
|
18
|
+
#define timespecafter(tsp, usp) \
|
19
|
+
(((tsp)->tv_sec > (usp)->tv_sec) || \
|
20
|
+
((tsp)->tv_sec == (usp)->tv_sec && (tsp)->tv_nsec > (usp)->tv_nsec))
|
data/lib/sqlite3/constants.rb
CHANGED
@@ -1,50 +1,174 @@
|
|
1
|
-
module SQLite3
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
module SQLite3
|
2
|
+
module Constants
|
3
|
+
#
|
4
|
+
# CAPI3REF: Text Encodings
|
5
|
+
#
|
6
|
+
# These constant define integer codes that represent the various
|
7
|
+
# text encodings supported by SQLite.
|
8
|
+
#
|
9
|
+
module TextRep
|
10
|
+
# IMP: R-37514-35566
|
11
|
+
UTF8 = 1
|
12
|
+
# IMP: R-03371-37637
|
13
|
+
UTF16LE = 2
|
14
|
+
# IMP: R-51971-34154
|
15
|
+
UTF16BE = 3
|
16
|
+
# Use native byte order
|
17
|
+
UTF16 = 4
|
18
|
+
# Deprecated
|
19
|
+
ANY = 5
|
20
|
+
# sqlite3_create_collation only
|
21
|
+
DETERMINISTIC = 0x800
|
22
|
+
end
|
11
23
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
#
|
25
|
+
# CAPI3REF: Fundamental Datatypes
|
26
|
+
#
|
27
|
+
# ^(Every value in SQLite has one of five fundamental datatypes:
|
28
|
+
#
|
29
|
+
# <ul>
|
30
|
+
# <li> 64-bit signed integer
|
31
|
+
# <li> 64-bit IEEE floating point number
|
32
|
+
# <li> string
|
33
|
+
# <li> BLOB
|
34
|
+
# <li> NULL
|
35
|
+
# </ul>)^
|
36
|
+
#
|
37
|
+
# These constants are codes for each of those types.
|
38
|
+
#
|
39
|
+
module ColumnType
|
40
|
+
INTEGER = 1
|
41
|
+
FLOAT = 2
|
42
|
+
TEXT = 3
|
43
|
+
BLOB = 4
|
44
|
+
NULL = 5
|
45
|
+
end
|
19
46
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
#
|
48
|
+
# CAPI3REF: Result Codes
|
49
|
+
#
|
50
|
+
# Many SQLite functions return an integer result code from the set shown
|
51
|
+
# here in order to indicate success or failure.
|
52
|
+
#
|
53
|
+
# New error codes may be added in future versions of SQLite.
|
54
|
+
#
|
55
|
+
module ErrorCode
|
56
|
+
# Successful result
|
57
|
+
OK = 0
|
58
|
+
# SQL error or missing database
|
59
|
+
ERROR = 1
|
60
|
+
# An internal logic error in SQLite
|
61
|
+
INTERNAL = 2
|
62
|
+
# Access permission denied
|
63
|
+
PERM = 3
|
64
|
+
# Callback routine requested an abort
|
65
|
+
ABORT = 4
|
66
|
+
# The database file is locked
|
67
|
+
BUSY = 5
|
68
|
+
# A table in the database is locked
|
69
|
+
LOCKED = 6
|
70
|
+
# A malloc() failed
|
71
|
+
NOMEM = 7
|
72
|
+
# Attempt to write a readonly database
|
73
|
+
READONLY = 8
|
74
|
+
# Operation terminated by sqlite_interrupt()
|
75
|
+
INTERRUPT = 9
|
76
|
+
# Some kind of disk I/O error occurred
|
77
|
+
IOERR = 10
|
78
|
+
# The database disk image is malformed
|
79
|
+
CORRUPT = 11
|
80
|
+
# (Internal Only) Table or record not found
|
81
|
+
NOTFOUND = 12
|
82
|
+
# Insertion failed because database is full
|
83
|
+
FULL = 13
|
84
|
+
# Unable to open the database file
|
85
|
+
CANTOPEN = 14
|
86
|
+
# Database lock protocol error
|
87
|
+
PROTOCOL = 15
|
88
|
+
# (Internal Only) Database table is empty
|
89
|
+
EMPTY = 16
|
90
|
+
# The database schema changed
|
91
|
+
SCHEMA = 17
|
92
|
+
# Too much data for one row of a table
|
93
|
+
TOOBIG = 18
|
94
|
+
# Abort due to constraint violation
|
95
|
+
CONSTRAINT = 19
|
96
|
+
# Data type mismatch
|
97
|
+
MISMATCH = 20
|
98
|
+
# Library used incorrectly
|
99
|
+
MISUSE = 21
|
100
|
+
# Uses OS features not supported on host
|
101
|
+
NOLFS = 22
|
102
|
+
# Authorization denied
|
103
|
+
AUTH = 23
|
104
|
+
# Not used
|
105
|
+
FORMAT = 24
|
106
|
+
# 2nd parameter to sqlite3_bind out of range
|
107
|
+
RANGE = 25
|
108
|
+
# File opened that is not a database file
|
109
|
+
NOTADB = 26
|
110
|
+
# Notifications from sqlite3_log()
|
111
|
+
NOTICE = 27
|
112
|
+
# Warnings from sqlite3_log()
|
113
|
+
WARNING = 28
|
114
|
+
# sqlite_step() has another row ready
|
115
|
+
ROW = 100
|
116
|
+
# sqlite_step() has finished executing
|
117
|
+
DONE = 101
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# CAPI3REF: Status Parameters
|
122
|
+
#
|
123
|
+
# These integer constants designate various run-time status parameters
|
124
|
+
# that can be returned by SQLite3.status
|
125
|
+
#
|
126
|
+
module Status
|
127
|
+
# This parameter is the current amount of memory checked out using sqlite3_malloc(), either
|
128
|
+
# directly or indirectly. The figure includes calls made to sqlite3_malloc() by the
|
129
|
+
# application and internal memory usage by the SQLite library. Auxiliary page-cache memory
|
130
|
+
# controlled by SQLITE_CONFIG_PAGECACHE is not included in this parameter. The amount returned
|
131
|
+
# is the sum of the allocation sizes as reported by the xSize method in sqlite3_mem_methods.
|
132
|
+
MEMORY_USED = 0
|
133
|
+
|
134
|
+
# This parameter returns the number of pages used out of the pagecache memory allocator that
|
135
|
+
# was configured using SQLITE_CONFIG_PAGECACHE. The value returned is in pages, not in bytes.
|
136
|
+
PAGECACHE_USED = 1
|
137
|
+
|
138
|
+
# This parameter returns the number of bytes of page cache allocation which could not be
|
139
|
+
# satisfied by the SQLITE_CONFIG_PAGECACHE buffer and where forced to overflow to
|
140
|
+
# sqlite3_malloc(). The returned value includes allocations that overflowed because they where
|
141
|
+
# too large (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE) and
|
142
|
+
# allocations that overflowed because no space was left in the page cache.
|
143
|
+
PAGECACHE_OVERFLOW = 2
|
144
|
+
|
145
|
+
# NOT USED
|
146
|
+
SCRATCH_USED = 3
|
49
147
|
|
50
|
-
|
148
|
+
# NOT USED
|
149
|
+
SCRATCH_OVERFLOW = 4
|
150
|
+
|
151
|
+
# This parameter records the largest memory allocation request handed to sqlite3_malloc() or
|
152
|
+
# sqlite3_realloc() (or their internal equivalents). Only the value returned in the
|
153
|
+
# *pHighwater parameter to sqlite3_status() is of interest. The value written into the
|
154
|
+
# *pCurrent parameter is undefined.
|
155
|
+
MALLOC_SIZE = 5
|
156
|
+
|
157
|
+
# The *pHighwater parameter records the deepest parser stack. The *pCurrent value is
|
158
|
+
# undefined. The *pHighwater value is only meaningful if SQLite is compiled with
|
159
|
+
# YYTRACKMAXSTACKDEPTH.
|
160
|
+
PARSER_STACK = 6
|
161
|
+
|
162
|
+
# This parameter records the largest memory allocation request handed to the pagecache memory
|
163
|
+
# allocator. Only the value returned in the *pHighwater parameter to sqlite3_status() is of
|
164
|
+
# interest. The value written into the *pCurrent parameter is undefined.
|
165
|
+
PAGECACHE_SIZE = 7
|
166
|
+
|
167
|
+
# NOT USED
|
168
|
+
SCRATCH_SIZE = 8
|
169
|
+
|
170
|
+
# This parameter records the number of separate memory allocations currently checked out.
|
171
|
+
MALLOC_COUNT = 9
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|