stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.68k stars 1.56k forks source link

Support for database backup (sqlite3_backup_init) #919

Closed kkapitan closed 3 years ago

kkapitan commented 5 years ago

Hi,

First of all - thank you for this amazing utility! My team and I are using this in some parts of our application and we are planning to expand the usage even further. However one feature of sqlite that we rely on is the ability to dump in memory databases to a file. It would be great to have that as a part of this library and that's why I'm leaving this Pull Request here with an example implementation.

I'm happy to hear any feedback from you and thanks again for your work!

jberkel commented 3 years ago

@kkapitan thanks for the PR, looking good. I think the API would be more intuitive if the source parameters came first:

return try Backup(sourceConnection: self,
                  sourceName: databaseName,
                  targetConnection: targetConnection,
                  targetName: targetDatabaseName)