extralite-bundle 2.8 → 2.8.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/examples/pubsub_store_polyphony.rb +5 -5
- data/ext/extralite/database.c +6 -0
- data/ext/sqlite3/sqlite3.c +494 -198
- data/ext/sqlite3/sqlite3.h +22 -3
- data/lib/extralite/version.rb +1 -1
- data/test/test_database.rb +45 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3cd8157614888cebb1d10a4007280fbb056d172bf06447de867cf30071914bf
|
4
|
+
data.tar.gz: 8f97df0223c5e055c675b386d1e098f61ad4189cfe8f9f03010785f59e544eb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aded223d20a4075d0d7b3f503bed83f86bec6d7c1ed16d4fdf20e9d2df0e8b636c88ce6a8bbe522a56302a9a051e5c774e15b78be5a018716aa502cf2c44a6ab
|
7
|
+
data.tar.gz: f38bdb92fd2b3a4f33af008a0b704ee1974a41660a90b46ae149f17296bdeeb46db4a9b9913af3bd2344c0bf278106ca10dc00f629a40a6c0e2ccd8e78c6df60
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,7 @@ databases.
|
|
32
32
|
Extralite comes in two flavors: the `extralite` gem which uses the
|
33
33
|
system-installed sqlite3 library, and the `extralite-bundle` gem which bundles
|
34
34
|
the latest version of SQLite
|
35
|
-
([3.45.
|
35
|
+
([3.45.3](https://sqlite.org/releaselog/3_45_3.html)), offering access to the
|
36
36
|
latest features and enhancements.
|
37
37
|
|
38
38
|
## Features
|
@@ -103,9 +103,9 @@ db2.pragma(journal_mode: :wal, synchronous: 1)
|
|
103
103
|
db3 = Extralite::Database.new(fn)
|
104
104
|
db3.pragma(journal_mode: :wal, synchronous: 1)
|
105
105
|
|
106
|
-
db1.on_progress
|
107
|
-
db2.on_progress
|
108
|
-
db3.on_progress
|
106
|
+
db1.on_progress { |b| b ? sleep(0.0001) : snooze }
|
107
|
+
db2.on_progress { |b| b ? sleep(0.0001) : snooze }
|
108
|
+
db3.on_progress { |b| b ? sleep(0.0001) : snooze }
|
109
109
|
|
110
110
|
producer = PubSub.new(db1)
|
111
111
|
producer.setup
|
@@ -163,7 +163,7 @@ end
|
|
163
163
|
|
164
164
|
db4 = Extralite::Database.new(fn)
|
165
165
|
db4.pragma(journal_mode: :wal, synchronous: 1)
|
166
|
-
db4.on_progress
|
166
|
+
db4.on_progress { |busy| busy ? sleep(0.05) : snooze }
|
167
167
|
|
168
168
|
last_t = Time.now
|
169
169
|
last_publish_count = 0
|
@@ -175,7 +175,7 @@ while true
|
|
175
175
|
d_publish = publish_count - last_publish_count
|
176
176
|
d_receive = receive_count - last_receive_count
|
177
177
|
pending = db4.query_single_splat('select count(*) from messages')
|
178
|
-
puts "#{Time.now} publish: #{d_publish/elapsed}/s receive: #{d_receive/elapsed}/s pending: #{pending}"
|
178
|
+
puts "#{Time.now} publish: #{(d_publish/elapsed).round}/s receive: #{(d_receive/elapsed).round}/s pending: #{pending} latency: #{pending / (d_receive/elapsed)}"
|
179
179
|
last_t = now
|
180
180
|
last_publish_count = publish_count
|
181
181
|
last_receive_count = receive_count
|
data/ext/extralite/database.c
CHANGED
@@ -294,6 +294,8 @@ static inline VALUE Database_perform_query(int argc, VALUE *argv, VALUE self, VA
|
|
294
294
|
prepare_multi_stmt(DB_GVL_MODE(db), db->sqlite3_db, &stmt, sql);
|
295
295
|
RB_GC_GUARD(sql);
|
296
296
|
|
297
|
+
if (stmt == NULL) return Qnil;
|
298
|
+
|
297
299
|
bind_all_parameters(stmt, argc - 1, argv + 1);
|
298
300
|
query_ctx ctx = QUERY_CTX(
|
299
301
|
self, sql, db, stmt, Qnil, transform,
|
@@ -485,6 +487,10 @@ VALUE Database_query_single_array(int argc, VALUE *argv, VALUE self) {
|
|
485
487
|
* specified using keyword arguments:
|
486
488
|
*
|
487
489
|
* db.execute('update foo set x = :bar', bar: 42)
|
490
|
+
*
|
491
|
+
* @param sql [String] query SQL
|
492
|
+
* @param parameters [Array, Hash] parameters to run query with
|
493
|
+
* @return [Integer, nil] Total number of changes effected or `nil` if the query ends with a comment.
|
488
494
|
*/
|
489
495
|
VALUE Database_execute(int argc, VALUE *argv, VALUE self) {
|
490
496
|
return Database_perform_query(argc, argv, self, safe_query_changes, QUERY_HASH);
|