Like.A.Glove. Thank you, Jeremy!
Dave Woodall davewoodall.com On Tue, Apr 16, 2019 at 5:29 PM Jeremy Evans <[email protected]> wrote: > On Wednesday, April 17, 2019 at 4:38:56 AM UTC+9, fake farm wrote: >> >> Greetings friends, >> I'm following the readme: >> >> >> DB = Sequel.sqlite >> DB.create_table :items do; end >> # added a few items >> >> >> >> How do I save that in to a local file, like *itemsDB.sqlite* >> >> >> I tried DB.dump, File.write, the docs, and Stack Overflow but came up >> short. >> >> Thank you! >> > > Sequel doesn't have direct support for this, but you can use > ruby-sqlite3's backup support to do so: > https://github.com/sparklemotion/sqlite3-ruby/blob/b6862d8f2542ce795ac6374ab1b1ddd08af8fd4d/ext/sqlite3/backup.c#L23 > > Something like this (untested): > > DB.synchronize do |conn| > b = SQLite3::Backup.new(SQLite3::Database.new('itemsDB.sqlite'), 'main', > conn, 'main') > b.step(-1) > b.finish > end > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sequel-talk. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
