extralite-bundle 2.8 → 2.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,9 +146,9 @@ extern "C" {
146
146
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147
147
  ** [sqlite_version()] and [sqlite_source_id()].
148
148
  */
149
- #define SQLITE_VERSION "3.45.0"
150
- #define SQLITE_VERSION_NUMBER 3045000
151
- #define SQLITE_SOURCE_ID "2024-01-15 17:01:13 1066602b2b1976fe58b5150777cced894af17c803e068f5918390d6915b46e1d"
149
+ #define SQLITE_VERSION "3.46.0"
150
+ #define SQLITE_VERSION_NUMBER 3046000
151
+ #define SQLITE_SOURCE_ID "2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e"
152
152
 
153
153
  /*
154
154
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -420,6 +420,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
420
420
  ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
421
421
  ** <li> The application must not modify the SQL statement text passed into
422
422
  ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
423
+ ** <li> The application must not dereference the arrays or string pointers
424
+ ** passed as the 3rd and 4th callback parameters after it returns.
423
425
  ** </ul>
424
426
  */
425
427
  SQLITE_API int sqlite3_exec(
@@ -762,11 +764,11 @@ struct sqlite3_file {
762
764
  ** </ul>
763
765
  ** xLock() upgrades the database file lock. In other words, xLock() moves the
764
766
  ** database file lock in the direction NONE toward EXCLUSIVE. The argument to
765
- ** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
767
+ ** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
766
768
  ** SQLITE_LOCK_NONE. If the database file lock is already at or above the
767
769
  ** requested lock, then the call to xLock() is a no-op.
768
770
  ** xUnlock() downgrades the database file lock to either SHARED or NONE.
769
- * If the lock is already at or below the requested lock state, then the call
771
+ ** If the lock is already at or below the requested lock state, then the call
770
772
  ** to xUnlock() is a no-op.
771
773
  ** The xCheckReservedLock() method checks whether any database connection,
772
774
  ** either in this process or in some other process, is holding a RESERVED,
@@ -2141,6 +2143,22 @@ struct sqlite3_mem_methods {
2141
2143
  ** configuration setting is never used, then the default maximum is determined
2142
2144
  ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2143
2145
  ** compile-time option is not set, then the default maximum is 1073741824.
2146
+ **
2147
+ ** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
2148
+ ** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
2149
+ ** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
2150
+ ** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
2151
+ ** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
2152
+ ** defaults to on. This configuration option queries the current setting or
2153
+ ** changes the setting to off or on. The argument is a pointer to an integer.
2154
+ ** If that integer initially holds a value of 1, then the ability for VIEWs to
2155
+ ** have ROWIDs is activated. If the integer initially holds zero, then the
2156
+ ** ability is deactivated. Any other initial value for the integer leaves the
2157
+ ** setting unchanged. After changes, if any, the integer is written with
2158
+ ** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
2159
+ ** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
2160
+ ** recommended case) then the integer is always filled with zero, regardless
2161
+ ** if its initial value.
2144
2162
  ** </dl>
2145
2163
  */
2146
2164
  #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2172,6 +2190,7 @@ struct sqlite3_mem_methods {
2172
2190
  #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
2173
2191
  #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
2174
2192
  #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
2193
+ #define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
2175
2194
 
2176
2195
  /*
2177
2196
  ** CAPI3REF: Database Connection Configuration Options
@@ -3286,8 +3305,8 @@ SQLITE_API int sqlite3_set_authorizer(
3286
3305
  #define SQLITE_RECURSIVE 33 /* NULL NULL */
3287
3306
 
3288
3307
  /*
3289
- ** CAPI3REF: Tracing And Profiling Functions
3290
- ** METHOD: sqlite3
3308
+ ** CAPI3REF: Deprecated Tracing And Profiling Functions
3309
+ ** DEPRECATED
3291
3310
  **
3292
3311
  ** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
3293
3312
  ** instead of the routines described here.
@@ -6868,6 +6887,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
6868
6887
  ** The exceptions defined in this paragraph might change in a future
6869
6888
  ** release of SQLite.
6870
6889
  **
6890
+ ** Whether the update hook is invoked before or after the
6891
+ ** corresponding change is currently unspecified and may differ
6892
+ ** depending on the type of change. Do not rely on the order of the
6893
+ ** hook call with regards to the final result of the operation which
6894
+ ** triggers the hook.
6895
+ **
6871
6896
  ** The update hook implementation must not do anything that will modify
6872
6897
  ** the database connection that invoked the update hook. Any actions
6873
6898
  ** to modify the database connection must be deferred until after the
@@ -8338,7 +8363,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8338
8363
  ** The sqlite3_keyword_count() interface returns the number of distinct
8339
8364
  ** keywords understood by SQLite.
8340
8365
  **
8341
- ** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
8366
+ ** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
8342
8367
  ** makes *Z point to that keyword expressed as UTF8 and writes the number
8343
8368
  ** of bytes in the keyword into *L. The string that *Z points to is not
8344
8369
  ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
@@ -9917,24 +9942,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9917
9942
  ** <li value="2"><p>
9918
9943
  ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
9919
9944
  ** that the query planner does not need the rows returned in any particular
9920
- ** order, as long as rows with the same values in all "aOrderBy" columns
9921
- ** are adjacent.)^ ^(Furthermore, only a single row for each particular
9922
- ** combination of values in the columns identified by the "aOrderBy" field
9923
- ** needs to be returned.)^ ^It is always ok for two or more rows with the same
9924
- ** values in all "aOrderBy" columns to be returned, as long as all such rows
9925
- ** are adjacent. ^The virtual table may, if it chooses, omit extra rows
9926
- ** that have the same value for all columns identified by "aOrderBy".
9927
- ** ^However omitting the extra rows is optional.
9945
+ ** order, as long as rows with the same values in all columns identified
9946
+ ** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
9947
+ ** contain the same values for all columns identified by "colUsed", all but
9948
+ ** one such row may optionally be omitted from the result.)^
9949
+ ** The virtual table is not required to omit rows that are duplicates
9950
+ ** over the "colUsed" columns, but if the virtual table can do that without
9951
+ ** too much extra effort, it could potentially help the query to run faster.
9928
9952
  ** This mode is used for a DISTINCT query.
9929
9953
  ** <li value="3"><p>
9930
- ** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
9931
- ** that the query planner needs only distinct rows but it does need the
9932
- ** rows to be sorted.)^ ^The virtual table implementation is free to omit
9933
- ** rows that are identical in all aOrderBy columns, if it wants to, but
9934
- ** it is not required to omit any rows. This mode is used for queries
9954
+ ** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
9955
+ ** virtual table must return rows in the order defined by "aOrderBy" as
9956
+ ** if the sqlite3_vtab_distinct() interface had returned 0. However if
9957
+ ** two or more rows in the result have the same values for all columns
9958
+ ** identified by "colUsed", then all but one such row may optionally be
9959
+ ** omitted.)^ Like when the return value is 2, the virtual table
9960
+ ** is not required to omit rows that are duplicates over the "colUsed"
9961
+ ** columns, but if the virtual table can do that without
9962
+ ** too much extra effort, it could potentially help the query to run faster.
9963
+ ** This mode is used for queries
9935
9964
  ** that have both DISTINCT and ORDER BY clauses.
9936
9965
  ** </ol>
9937
9966
  **
9967
+ ** <p>The following table summarizes the conditions under which the
9968
+ ** virtual table is allowed to set the "orderByConsumed" flag based on
9969
+ ** the value returned by sqlite3_vtab_distinct(). This table is a
9970
+ ** restatement of the previous four paragraphs:
9971
+ **
9972
+ ** <table border=1 cellspacing=0 cellpadding=10 width="90%">
9973
+ ** <tr>
9974
+ ** <td valign="top">sqlite3_vtab_distinct() return value
9975
+ ** <td valign="top">Rows are returned in aOrderBy order
9976
+ ** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
9977
+ ** <td valign="top">Duplicates over all colUsed columns may be omitted
9978
+ ** <tr><td>0<td>yes<td>yes<td>no
9979
+ ** <tr><td>1<td>no<td>yes<td>no
9980
+ ** <tr><td>2<td>no<td>yes<td>yes
9981
+ ** <tr><td>3<td>yes<td>yes<td>yes
9982
+ ** </table>
9983
+ **
9938
9984
  ** ^For the purposes of comparing virtual table output values to see if the
9939
9985
  ** values are same value for sorting purposes, two NULL values are considered
9940
9986
  ** to be the same. In other words, the comparison operator is "IS"
@@ -11979,6 +12025,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
11979
12025
  */
11980
12026
  SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
11981
12027
 
12028
+ /*
12029
+ ** CAPI3REF: Add A Single Change To A Changegroup
12030
+ ** METHOD: sqlite3_changegroup
12031
+ **
12032
+ ** This function adds the single change currently indicated by the iterator
12033
+ ** passed as the second argument to the changegroup object. The rules for
12034
+ ** adding the change are just as described for [sqlite3changegroup_add()].
12035
+ **
12036
+ ** If the change is successfully added to the changegroup, SQLITE_OK is
12037
+ ** returned. Otherwise, an SQLite error code is returned.
12038
+ **
12039
+ ** The iterator must point to a valid entry when this function is called.
12040
+ ** If it does not, SQLITE_ERROR is returned and no change is added to the
12041
+ ** changegroup. Additionally, the iterator must not have been opened with
12042
+ ** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
12043
+ ** returned.
12044
+ */
12045
+ SQLITE_API int sqlite3changegroup_add_change(
12046
+ sqlite3_changegroup*,
12047
+ sqlite3_changeset_iter*
12048
+ );
12049
+
12050
+
12051
+
11982
12052
  /*
11983
12053
  ** CAPI3REF: Obtain A Composite Changeset From A Changegroup
11984
12054
  ** METHOD: sqlite3_changegroup
@@ -12783,8 +12853,8 @@ struct Fts5PhraseIter {
12783
12853
  ** EXTENSION API FUNCTIONS
12784
12854
  **
12785
12855
  ** xUserData(pFts):
12786
- ** Return a copy of the context pointer the extension function was
12787
- ** registered with.
12856
+ ** Return a copy of the pUserData pointer passed to the xCreateFunction()
12857
+ ** API when the extension function was registered.
12788
12858
  **
12789
12859
  ** xColumnTotalSize(pFts, iCol, pnToken):
12790
12860
  ** If parameter iCol is less than zero, set output variable *pnToken
@@ -1,4 +1,4 @@
1
1
  module Extralite
2
2
  # Extralite version
3
- VERSION = '2.8'
3
+ VERSION = '2.8.2'
4
4
  end
Binary file
Binary file
Binary file
@@ -277,10 +277,14 @@ class DatabaseTest < Minitest::Test
277
277
 
278
278
  def test_extension_loading
279
279
  case RUBY_PLATFORM
280
- when /linux/
281
- @db.load_extension(File.join(__dir__, 'extensions/text.so'))
282
- when /darwin/
283
- @db.load_extension(File.join(__dir__, 'extensions/text.dylib'))
280
+ when /aarch64-linux/
281
+ @db.load_extension(File.join(__dir__, 'extensions/arm64/text.so'))
282
+ when /x86_64-linux/
283
+ @db.load_extension(File.join(__dir__, 'extensions/x86/text.so'))
284
+ when /arm64-darwin/
285
+ @db.load_extension(File.join(__dir__, 'extensions/arm64/text.dylib'))
286
+ when /x86_64-darwin/
287
+ @db.load_extension(File.join(__dir__, 'extensions/x86/text.dylib'))
284
288
  end
285
289
 
286
290
  r = @db.query_single_splat("select reverse('abcd')")
@@ -948,7 +952,7 @@ class DatabaseTest < Minitest::Test
948
952
 
949
953
  db.execute('insert into foo values (43)')
950
954
  assert_equal [42, 43], db.query_splat('select x from foo')
951
-
955
+
952
956
  db.savepoint(:b)
953
957
 
954
958
  db.execute('insert into foo values (44)')
@@ -1046,6 +1050,48 @@ class DatabaseTest < Minitest::Test
1046
1050
  assert File.size(wal_fn) == 0
1047
1051
  assert_equal [0, 0], r
1048
1052
  end
1053
+
1054
+ def test_execute_with_comments
1055
+ result = @db.execute(<<~SQL)
1056
+ -- this is a comment
1057
+ SQL
1058
+ assert_nil result
1059
+
1060
+ result = @db.execute(<<~SQL)
1061
+ DELETE FROM t;
1062
+ INSERT INTO t (x, y, z) VALUES (1, 1, 1);
1063
+ INSERT INTO t (x, y, z) VALUES (2, 2, 2);
1064
+ SQL
1065
+ assert_equal 1, result
1066
+ assert_equal [1, 2], @db.query_splat('SELECT x FROM t ORDER BY x')
1067
+
1068
+ result = @db.execute(<<~SQL)
1069
+ -- this is a comment at the beginning
1070
+ DELETE FROM t;
1071
+ INSERT INTO t (x, y, z) VALUES (3, 3, 3);
1072
+ INSERT INTO t (x, y, z) VALUES (4, 4, 4);
1073
+ SQL
1074
+ assert_equal 1, result
1075
+ assert_equal [3, 4], @db.query_splat('SELECT x FROM t ORDER BY x')
1076
+
1077
+ result = @db.execute(<<~SQL)
1078
+ DELETE FROM t;
1079
+ INSERT INTO t (x, y, z) VALUES (5, 5, 5);
1080
+ -- this is a comment in the middle
1081
+ INSERT INTO t (x, y, z) VALUES (6, 6, 6);
1082
+ SQL
1083
+ assert_equal 1, result
1084
+ assert_equal [5, 6], @db.query_splat('SELECT x FROM t ORDER BY x')
1085
+
1086
+ result = @db.execute(<<~SQL)
1087
+ DELETE FROM t;
1088
+ INSERT INTO t (x, y, z) VALUES (7, 7, 7);
1089
+ INSERT INTO t (x, y, z) VALUES (8, 8, 8);
1090
+ -- this is a comment at the end
1091
+ SQL
1092
+ assert_nil result
1093
+ assert_equal [7, 8], @db.query_splat('SELECT x FROM t ORDER BY x')
1094
+ end
1049
1095
  end
1050
1096
 
1051
1097
  class ScenarioTest < Minitest::Test
@@ -1438,7 +1484,7 @@ class ConcurrencyTest < Minitest::Test
1438
1484
 
1439
1485
  def test_progress_handler_invalid_arg
1440
1486
  db = Extralite::Database.new(':memory:')
1441
-
1487
+
1442
1488
  assert_raises(TypeError) { db.on_progress(period: :foo) }
1443
1489
  assert_raises(TypeError) { db.on_progress(tick: :foo) }
1444
1490
  assert_raises(ArgumentError) { db.on_progress(mode: :foo) }
@@ -1635,7 +1681,7 @@ end
1635
1681
  class RactorTest < Minitest::Test
1636
1682
  def test_ractor_simple
1637
1683
  skip if SKIP_RACTOR_TESTS
1638
-
1684
+
1639
1685
  fn = Tempfile.new('extralite_test_database_in_ractor').path
1640
1686
 
1641
1687
  r = Ractor.new do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extralite-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.8'
4
+ version: 2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-10 00:00:00.000000000 Z
11
+ date: 2024-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -125,8 +125,10 @@ files:
125
125
  - lib/extralite.rb
126
126
  - lib/extralite/version.rb
127
127
  - lib/sequel/adapters/extralite.rb
128
- - test/extensions/text.dylib
129
- - test/extensions/text.so
128
+ - test/extensions/arm64/text.dylib
129
+ - test/extensions/arm64/text.so
130
+ - test/extensions/x86/text.dylib
131
+ - test/extensions/x86/text.so
130
132
  - test/fixtures/image.png
131
133
  - test/helper.rb
132
134
  - test/issue-38.rb
Binary file