sqlite3-ruby 1.2.1-mswin32 → 1.2.2-mswin32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sqlite3-ruby might be problematic. Click here for more details.
- data/{README → README.rdoc} +2 -6
- data/doc/faq/faq.rb +1 -33
- data/ext/sqlite3_api/extconf.rb +3 -0
- data/ext/sqlite3_api/sqlite3_api.i +27 -28
- data/ext/sqlite3_api/sqlite3_api_wrap.c +36 -37
- data/ext/sqlite3_api/sqlite3_api_wrap.dll +0 -0
- data/ext/sqlite3_api/sqlite3_api_wrap.exp +0 -0
- data/ext/sqlite3_api/sqlite3_api_wrap.lib +0 -0
- data/ext/sqlite3_api/sqlite3_api_wrap.obj +0 -0
- data/ext/sqlite3_api/win32/build.bat +7 -7
- data/lib/sqlite3.rb +0 -32
- data/lib/sqlite3/constants.rb +0 -32
- data/lib/sqlite3/database.rb +7 -37
- data/lib/sqlite3/driver/dl/api.rb +0 -32
- data/lib/sqlite3/driver/dl/driver.rb +1 -32
- data/lib/sqlite3/driver/native/driver.rb +1 -33
- data/lib/sqlite3/errors.rb +1 -33
- data/lib/sqlite3/pragmas.rb +5 -35
- data/lib/sqlite3/resultset.rb +13 -39
- data/lib/sqlite3/statement.rb +5 -33
- data/lib/sqlite3/translator.rb +12 -39
- data/lib/sqlite3/value.rb +0 -32
- data/lib/sqlite3/version.rb +1 -33
- data/lib/sqlite3_api.dll +0 -0
- data/test/driver/dl/tc_driver.rb +0 -32
- data/test/mocks.rb +22 -79
- data/test/tc_database.rb +47 -65
- data/test/tc_errors.rb +2 -35
- data/test/tc_integration.rb +112 -64
- data/test/tests.rb +4 -34
- metadata +20 -18
- data/doc/faq/faq.html +0 -408
- data/ext/sqlite3_api/Makefile +0 -143
- data/lib/sqlite3_api.so +0 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
|
-
REM This is not guaranteed to work, ever. It's just a little helper
|
2
|
-
REM script that I threw together to help me build the win32 version of
|
3
|
-
REM the library. If someone with more win32-fu than I wants to make
|
4
|
-
REM something more robust, please feel free! I'd love to include it.
|
5
|
-
REM -- Jamis Buck
|
6
|
-
|
7
|
-
cl /LD /Ie:\WinSDK\Include /Ic:\ruby\lib\ruby\1.8\i386-mswin32 /Ic:\ruby\sqlite3
|
1
|
+
REM This is not guaranteed to work, ever. It's just a little helper
|
2
|
+
REM script that I threw together to help me build the win32 version of
|
3
|
+
REM the library. If someone with more win32-fu than I wants to make
|
4
|
+
REM something more robust, please feel free! I'd love to include it.
|
5
|
+
REM -- Jamis Buck
|
6
|
+
|
7
|
+
cl /LD /Ie:\WinSDK\Include /Ic:\ruby\lib\ruby\1.8\i386-mswin32 /Ic:\ruby\sqlite3 /Ic:\ruby\src\ruby-1.8.4_2006-04-14 sqlite3_api_wrap.c /link /LIBPATH:c:\ruby\sqlite3 /LIBPATH:e:\WinSDK\Lib /LIBPATH:c:\ruby\lib sqlite3.lib msvcrt-ruby18.lib
|
data/lib/sqlite3.rb
CHANGED
@@ -1,33 +1 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'sqlite3/database'
|
data/lib/sqlite3/constants.rb
CHANGED
@@ -1,35 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
module SQLite3 ; module Constants
|
34
2
|
|
35
3
|
module TextRep
|
data/lib/sqlite3/database.rb
CHANGED
@@ -1,36 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
|
-
require 'base64'
|
34
1
|
require 'sqlite3/constants'
|
35
2
|
require 'sqlite3/errors'
|
36
3
|
require 'sqlite3/pragmas'
|
@@ -180,6 +147,9 @@ module SQLite3
|
|
180
147
|
|
181
148
|
# Returns a Statement object representing the given SQL. This does not
|
182
149
|
# execute the statement; it merely prepares the statement for execution.
|
150
|
+
#
|
151
|
+
# The Statement can then be executed using Statement#execute.
|
152
|
+
#
|
183
153
|
def prepare( sql )
|
184
154
|
stmt = @statement_factory.new( self, sql )
|
185
155
|
if block_given?
|
@@ -335,19 +305,19 @@ module SQLite3
|
|
335
305
|
# The handler will be invoked with the name of the resource that was
|
336
306
|
# busy, and the number of times it has been retried.
|
337
307
|
#
|
338
|
-
# See also #busy_timeout.
|
308
|
+
# See also the mutually exclusive #busy_timeout.
|
339
309
|
def busy_handler( data=nil, &block ) # :yields: data, retries
|
340
310
|
result = @driver.busy_handler( @handle, data, &block )
|
341
311
|
Error.check( result, self )
|
342
312
|
end
|
343
313
|
|
344
314
|
# Indicates that if a request for a resource terminates because that
|
345
|
-
# resource is busy, SQLite should
|
346
|
-
#
|
315
|
+
# resource is busy, SQLite should sleep and retry for up to the indicated
|
316
|
+
# number of milliseconds. By default, SQLite does not retry
|
347
317
|
# busy resources. To restore the default behavior, send 0 as the
|
348
318
|
# +ms+ parameter.
|
349
319
|
#
|
350
|
-
# See also #busy_handler.
|
320
|
+
# See also the mutually exclusive #busy_handler.
|
351
321
|
def busy_timeout( ms )
|
352
322
|
result = @driver.busy_timeout( @handle, ms )
|
353
323
|
Error.check( result, self )
|
@@ -1,35 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'dl/import'
|
34
2
|
|
35
3
|
module SQLite3 ; module Driver; module DL;
|
@@ -1,35 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'sqlite3/driver/dl/api'
|
34
2
|
|
35
3
|
warn "The DL driver for sqlite3-ruby is deprecated and will be removed"
|
@@ -263,6 +231,7 @@ module SQLite3 ; module Driver ; module DL
|
|
263
231
|
api_delegate :aggregate_count
|
264
232
|
api_delegate :bind_double
|
265
233
|
api_delegate :bind_int
|
234
|
+
api_delegate :bind_int64
|
266
235
|
api_delegate :bind_null
|
267
236
|
api_delegate :bind_parameter_index
|
268
237
|
api_delegate :bind_parameter_name
|
@@ -1,35 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'sqlite3_api'
|
34
2
|
|
35
3
|
module SQLite3 ; module Driver ; module Native
|
@@ -191,7 +159,7 @@ module SQLite3 ; module Driver ; module Native
|
|
191
159
|
end
|
192
160
|
|
193
161
|
def self.api_delegate( name )
|
194
|
-
|
162
|
+
eval "def #{name} (*args) API.sqlite3_#{name}( *args ) ; end"
|
195
163
|
end
|
196
164
|
|
197
165
|
api_delegate :libversion
|
data/lib/sqlite3/errors.rb
CHANGED
@@ -1,40 +1,8 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'sqlite3/constants'
|
34
2
|
|
35
3
|
module SQLite3
|
36
4
|
|
37
|
-
class Exception < ::
|
5
|
+
class Exception < ::StandardError
|
38
6
|
@code = 0
|
39
7
|
|
40
8
|
# The numeric error code that this exception represents.
|
data/lib/sqlite3/pragmas.rb
CHANGED
@@ -1,35 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'sqlite3/errors'
|
34
2
|
|
35
3
|
module SQLite3
|
@@ -54,8 +22,8 @@ module SQLite3
|
|
54
22
|
case mode
|
55
23
|
when String
|
56
24
|
case mode.downcase
|
57
|
-
when "on", "yes", "true", "y", "t"
|
58
|
-
when "off", "no", "false", "n", "f"
|
25
|
+
when "on", "yes", "true", "y", "t"; mode = "'ON'"
|
26
|
+
when "off", "no", "false", "n", "f"; mode = "'OFF'"
|
59
27
|
else
|
60
28
|
raise Exception,
|
61
29
|
"unrecognized pragma parameter #{mode.inspect}"
|
@@ -290,10 +258,12 @@ module SQLite3
|
|
290
258
|
# unquotes those values.
|
291
259
|
def tweak_default(hash)
|
292
260
|
case hash["dflt_value"]
|
293
|
-
when /^null$/i
|
261
|
+
when /^null$/i
|
294
262
|
hash["dflt_value"] = nil
|
295
263
|
when /^'(.*)'$/
|
296
264
|
hash["dflt_value"] = $1.gsub(/''/, "'")
|
265
|
+
when /^"(.*)"$/
|
266
|
+
hash["dflt_value"] = $1.gsub(/""/, '"')
|
297
267
|
end
|
298
268
|
end
|
299
269
|
end
|
data/lib/sqlite3/resultset.rb
CHANGED
@@ -1,35 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright notice,
|
10
|
-
# this list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# * Redistributions in binary form must reproduce the above copyright
|
13
|
-
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
15
|
-
#
|
16
|
-
# * The names of its contributors may not be used to endorse or promote
|
17
|
-
# products derived from this software without specific prior written
|
18
|
-
# permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# =============================================================================
|
31
|
-
#++
|
32
|
-
|
33
1
|
require 'sqlite3/constants'
|
34
2
|
require 'sqlite3/errors'
|
35
3
|
|
@@ -65,6 +33,9 @@ module SQLite3
|
|
65
33
|
# to the first row of the result set.
|
66
34
|
def commence
|
67
35
|
result = @driver.step( @stmt.handle )
|
36
|
+
if result == Constants::ErrorCode::ERROR
|
37
|
+
@driver.reset( @stmt.handle )
|
38
|
+
end
|
68
39
|
check result
|
69
40
|
@first_row = true
|
70
41
|
end
|
@@ -121,13 +92,16 @@ module SQLite3
|
|
121
92
|
unless @eof
|
122
93
|
row = []
|
123
94
|
@driver.data_count( @stmt.handle ).times do |column|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
95
|
+
type = @driver.column_type( @stmt.handle, column )
|
96
|
+
|
97
|
+
if type == Constants::ColumnType::TEXT
|
98
|
+
row << @driver.column_text( @stmt.handle, column )
|
99
|
+
elsif type == Constants::ColumnType::NULL
|
100
|
+
row << nil
|
101
|
+
elsif type == Constants::ColumnType::BLOB
|
102
|
+
row << @driver.column_blob( @stmt.handle, column )
|
103
|
+
else
|
104
|
+
row << @driver.column_text( @stmt.handle, column )
|
131
105
|
end
|
132
106
|
end
|
133
107
|
|