Multiple Databases Simultaneously

Hi Gwendal,
I'm looking at a problem that requires connection to 2 SQLite databases at the same time (RW on both). Its iOS 14 and latest GRDB if relevant.

I tried to work with this by implementing two separate DB Queues, one for each database. It seemed to work as far as opening the database but writing to the second seems like an issue.

Is this model supported by GRDB (in which case I can happily look for the bug in my own code) or if it's not I can then look at an alternative design (no idea what that is right now !)

Thanks

Paul

Hello @Paul-TM

Nothing prevents you from accessing two databases at the same time:

try dbQueue1.write { db1 in
  try dbQueue2.write { db2 in
    ...
  }
}

Thanks for the response Gwendal. Must be muddy code as I feared :smiley:

Terms of Service

Privacy Policy

Cookie Policy