You can execute a SQL query against your existing database by preparing a statement and then executing it:
db.connect do |conn| rows = conn.query 'SELECT * FROM users' rows.closeend
If you need to use placeholders for values, you can do that:
name = 'Iku'rows = conn.execute 'INSERT INTO users (id) VALUES (?)', [name]
5
Sync (Embedded Replicas only)
When using embedded replicas, you should call sync on the database to sync your local database with the primary database, unless you are using sync_interval (though there is no issue with calling sync with sync_interval enabled):