Colin Bartlett
2021-06-06 12:39:46 UTC
I'm using the following on Windows 10 with Ruby 2.7.2.
require 'sqlite3'
db = SQLite3::Database.open 'C:/sqlite/mytest.db'
p db
which gives:
#<SQLite3::Database:0x00000000064b6d00 ... , @readonly=false>
and with that I can read tables and also add rows to tables.
What I would like to be able to do is use something like:
db = SQLite3::Database.open 'C:/sqlite/mytest.db', argument
From searching the internet, 1 seems to be the flag which opens an
SQLite3 database as read only. But:
db = SQLite3::Database.open 'C:/sqlite/mytest.db', 1
raises a 'no implicit conversion of Symbol into Integer (TypeError)' exception.
db = SQLite3::Database.open 'C:/sqlite/mytest.db', xxxsymbolxxx: 1
works without raising an exception, but still: @readonly=false
Using :mode still gives: @readonly=false
Is there any Symbol instead of :xxxsymbolxxx or :mode which works?
Thanks for any hints.
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
require 'sqlite3'
db = SQLite3::Database.open 'C:/sqlite/mytest.db'
p db
which gives:
#<SQLite3::Database:0x00000000064b6d00 ... , @readonly=false>
and with that I can read tables and also add rows to tables.
What I would like to be able to do is use something like:
db = SQLite3::Database.open 'C:/sqlite/mytest.db', argument
From searching the internet, 1 seems to be the flag which opens an
SQLite3 database as read only. But:
db = SQLite3::Database.open 'C:/sqlite/mytest.db', 1
raises a 'no implicit conversion of Symbol into Integer (TypeError)' exception.
db = SQLite3::Database.open 'C:/sqlite/mytest.db', xxxsymbolxxx: 1
works without raising an exception, but still: @readonly=false
Using :mode still gives: @readonly=false
Is there any Symbol instead of :xxxsymbolxxx or :mode which works?
Thanks for any hints.
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>