Files
GRDB.swift/docs/6.3/data/documentation/grdb/databasequeue/backup(to:pagesperstep:progress:).json
2022-11-09 08:57:09 +01:00

1 line
13 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"backup"},{"kind":"text","text":"("},{"kind":"externalParam","text":"to"},{"kind":"text","text":" "},{"kind":"internalParam","text":"writer"},{"kind":"text","text":": some "},{"kind":"typeIdentifier","identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseWriter","preciseIdentifier":"s:4GRDB14DatabaseWriterP","text":"DatabaseWriter"},{"kind":"text","text":", "},{"kind":"externalParam","text":"pagesPerStep"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"CInt","preciseIdentifier":"s:s4CInta"},{"kind":"text","text":" = -1, "},{"kind":"externalParam","text":"progress"},{"kind":"text","text":": (("},{"kind":"typeIdentifier","identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseBackupProgress","preciseIdentifier":"s:4GRDB22DatabaseBackupProgressV","text":"DatabaseBackupProgress"},{"kind":"text","text":") "},{"kind":"keyword","text":"throws"},{"kind":"text","text":" -> "},{"kind":"typeIdentifier","text":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","text":")? = nil) "},{"kind":"keyword","text":"throws"}],"languages":["swift"],"platforms":["macOS"]}]},{"kind":"parameters","parameters":[{"name":"writer","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"The destination database."}]}]},{"name":"pagesPerStep","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"The number of database pages copied on each backup"},{"type":"text","text":" "},{"type":"text","text":"step. By default, all pages are copied in one single step."}]}]},{"name":"progress","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"An optional function that is notified of the backup"},{"type":"text","text":" "},{"type":"text","text":"progress."}]}]}]},{"kind":"content","content":[{"anchor":"discussion","level":2,"type":"heading","text":"Discussion"},{"type":"paragraph","inlineContent":[{"type":"text","text":"The "},{"type":"codeVoice","code":"backup"},{"type":"text","text":" method blocks the current thread until the destination"},{"type":"text","text":" "},{"type":"text","text":"database contains the same contents as the source database."}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"When the source is a DatabasePool, concurrent writes can happen during"},{"type":"text","text":" "},{"type":"text","text":"the backup. Those writes may, or may not, be reflected in the backup,"},{"type":"text","text":" "},{"type":"text","text":"but they won’t trigger any error."}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"Usage:"}]},{"type":"codeListing","syntax":"swift","code":["let source: DatabaseQueue = ...","let destination: DatabaseQueue = ...","try source.backup(to: destination)"]},{"type":"paragraph","inlineContent":[{"type":"text","text":"When you’re after progress reporting during backup, you’ll want to"},{"type":"text","text":" "},{"type":"text","text":"perform the backup in several steps. Each step copies the number of"},{"type":"text","text":" "},{"type":"emphasis","inlineContent":[{"type":"text","text":"database pages"}]},{"type":"text","text":" you specify. See "},{"type":"reference","isActive":true,"identifier":"https:\/\/www.sqlite.org\/c3ref\/backup_finish.html"},{"type":"text","text":" "},{"type":"text","text":"for more information:"}]},{"type":"codeListing","syntax":"swift","code":["\/\/ Backup with progress reporting","try source.backup(to: destination, pagesPerStep: ...) { progress in"," print(\"Database backup progress:\", progress)","}"]},{"type":"paragraph","inlineContent":[{"type":"text","text":"The "},{"type":"codeVoice","code":"progress"},{"type":"text","text":" callback will be called at least once—when"},{"type":"text","text":" "},{"type":"codeVoice","code":"backupProgress.isCompleted == true"},{"type":"text","text":". If the callback throws"},{"type":"text","text":" "},{"type":"text","text":"when "},{"type":"codeVoice","code":"backupProgress.isCompleted == false"},{"type":"text","text":", the backup is aborted"},{"type":"text","text":" "},{"type":"text","text":"and the error is rethrown. If the callback throws when"},{"type":"text","text":" "},{"type":"codeVoice","code":"backupProgress.isCompleted == true"},{"type":"text","text":", backup completion is"},{"type":"text","text":" "},{"type":"text","text":"unaffected and the error is silently ignored."}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"See also "},{"type":"reference","isActive":true,"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/Database\/backup(to:pagesPerStep:progress:)"}]},{"style":"note","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"A "},{"type":"reference","isActive":true,"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseError"},{"type":"text","text":" whenever an SQLite error occurs, or the"},{"type":"text","text":" "},{"type":"text","text":"error thrown by "},{"type":"codeVoice","code":"progress"},{"type":"text","text":"."}]}],"type":"aside","name":"Throws"}]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"variants":[{"paths":["\/documentation\/grdb\/databasequeue\/backup(to:pagesperstep:progress:)"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseQueue\/backup(to:pagesPerStep:progress:)","interfaceLanguage":"swift"},"abstract":[{"type":"text","text":"Copies the database contents into another database."}],"kind":"symbol","metadata":{"role":"symbol","title":"backup(to:pagesPerStep:progress:)","roleHeading":"Instance Method","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"backup"},{"kind":"text","text":"("},{"kind":"externalParam","text":"to"},{"kind":"text","text":": some "},{"kind":"typeIdentifier","text":"DatabaseWriter","preciseIdentifier":"s:4GRDB14DatabaseWriterP"},{"kind":"text","text":", "},{"kind":"externalParam","text":"pagesPerStep"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"CInt","preciseIdentifier":"s:s4CInta"},{"kind":"text","text":", "},{"kind":"externalParam","text":"progress"},{"kind":"text","text":": (("},{"kind":"typeIdentifier","text":"DatabaseBackupProgress","preciseIdentifier":"s:4GRDB22DatabaseBackupProgressV"},{"kind":"text","text":") "},{"kind":"keyword","text":"throws"},{"kind":"text","text":" -> "},{"kind":"typeIdentifier","text":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","text":")?) "},{"kind":"keyword","text":"throws"}],"symbolKind":"method","externalID":"s:4GRDB14DatabaseReaderPAAE6backup2to12pagesPerStep8progressyqd___s5Int32VyAA0B14BackupProgressVKcSgtKAA0B6WriterRd__lF::SYNTHESIZED::s:4GRDB13DatabaseQueueC","extendedModule":"GRDB","modules":[{"name":"GRDB"}]},"hierarchy":{"paths":[["doc:\/\/GRDB\/documentation\/GRDB","doc:\/\/GRDB\/documentation\/GRDB\/DatabaseConnections","doc:\/\/GRDB\/documentation\/GRDB\/DatabaseQueue","doc:\/\/GRDB\/documentation\/GRDB\/DatabaseQueue\/DatabaseReader-Implementations"]]},"references":{"doc://GRDB/documentation/GRDB/DatabaseBackupProgress":{"role":"symbol","title":"DatabaseBackupProgress","fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"DatabaseBackupProgress"}],"abstract":[{"type":"text","text":"Describe the progress of a database backup."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseBackupProgress","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"DatabaseBackupProgress"}],"url":"\/documentation\/grdb\/databasebackupprogress"},"doc://GRDB/documentation/GRDB/DatabaseQueue":{"role":"symbol","title":"DatabaseQueue","fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"DatabaseQueue"}],"abstract":[{"type":"text","text":"A database connection that serializes accesses to an SQLite database."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseQueue","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"DatabaseQueue"}],"url":"\/documentation\/grdb\/databasequeue"},"doc://GRDB/documentation/GRDB/DatabaseQueue/DatabaseReader-Implementations":{"role":"collectionGroup","title":"DatabaseReader Implementations","abstract":[],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseQueue\/DatabaseReader-Implementations","kind":"article","type":"topic","url":"\/documentation\/grdb\/databasequeue\/databasereader-implementations"},"doc://GRDB/documentation/GRDB/DatabaseConnections":{"role":"collectionGroup","title":"Database Connections","abstract":[{"type":"text","text":"Open database connections to SQLite databases."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseConnections","kind":"article","type":"topic","url":"\/documentation\/grdb\/databaseconnections"},"https://www.sqlite.org/c3ref/backup_finish.html":{"title":"https:\/\/www.sqlite.org\/c3ref\/backup_finish.html","titleInlineContent":[{"type":"text","text":"https:\/\/www.sqlite.org\/c3ref\/backup_finish.html"}],"type":"link","identifier":"https:\/\/www.sqlite.org\/c3ref\/backup_finish.html","url":"https:\/\/www.sqlite.org\/c3ref\/backup_finish.html"},"doc://GRDB/documentation/GRDB/Database/backup(to:pagesPerStep:progress:)":{"role":"symbol","title":"backup(to:pagesPerStep:progress:)","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"backup"},{"kind":"text","text":"("},{"kind":"externalParam","text":"to"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"Database","preciseIdentifier":"s:4GRDB8DatabaseC"},{"kind":"text","text":", "},{"kind":"externalParam","text":"pagesPerStep"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"CInt","preciseIdentifier":"s:s4CInta"},{"kind":"text","text":", "},{"kind":"externalParam","text":"progress"},{"kind":"text","text":": (("},{"kind":"typeIdentifier","text":"DatabaseBackupProgress","preciseIdentifier":"s:4GRDB22DatabaseBackupProgressV"},{"kind":"text","text":") "},{"kind":"keyword","text":"throws"},{"kind":"text","text":" -> "},{"kind":"typeIdentifier","text":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","text":")?) "},{"kind":"keyword","text":"throws"}],"abstract":[{"type":"text","text":"Copies the database contents into another database."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/Database\/backup(to:pagesPerStep:progress:)","kind":"symbol","type":"topic","url":"\/documentation\/grdb\/database\/backup(to:pagesperstep:progress:)"},"doc://GRDB/documentation/GRDB/DatabaseQueue/backup(to:pagesPerStep:progress:)":{"role":"symbol","title":"backup(to:pagesPerStep:progress:)","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"backup"},{"kind":"text","text":"("},{"kind":"externalParam","text":"to"},{"kind":"text","text":": some "},{"kind":"typeIdentifier","text":"DatabaseWriter","preciseIdentifier":"s:4GRDB14DatabaseWriterP"},{"kind":"text","text":", "},{"kind":"externalParam","text":"pagesPerStep"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"CInt","preciseIdentifier":"s:s4CInta"},{"kind":"text","text":", "},{"kind":"externalParam","text":"progress"},{"kind":"text","text":": (("},{"kind":"typeIdentifier","text":"DatabaseBackupProgress","preciseIdentifier":"s:4GRDB22DatabaseBackupProgressV"},{"kind":"text","text":") "},{"kind":"keyword","text":"throws"},{"kind":"text","text":" -> "},{"kind":"typeIdentifier","text":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","text":")?) "},{"kind":"keyword","text":"throws"}],"abstract":[{"type":"text","text":"Copies the database contents into another database."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseQueue\/backup(to:pagesPerStep:progress:)","kind":"symbol","type":"topic","url":"\/documentation\/grdb\/databasequeue\/backup(to:pagesperstep:progress:)"},"doc://GRDB/documentation/GRDB/DatabaseError":{"role":"symbol","title":"DatabaseError","fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"DatabaseError"}],"abstract":[{"type":"text","text":"A "},{"type":"codeVoice","code":"DatabaseError"},{"type":"text","text":" describes an SQLite error."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseError","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"DatabaseError"}],"url":"\/documentation\/grdb\/databaseerror"},"doc://GRDB/documentation/GRDB":{"role":"collection","title":"GRDB","abstract":[{"type":"text","text":"A toolkit for SQLite databases, with a focus on application development"}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB","kind":"symbol","type":"topic","url":"\/documentation\/grdb"},"doc://GRDB/documentation/GRDB/DatabaseWriter":{"role":"symbol","title":"DatabaseWriter","fragments":[{"kind":"keyword","text":"protocol"},{"kind":"text","text":" "},{"kind":"identifier","text":"DatabaseWriter"}],"abstract":[{"type":"text","text":"A type that write into an SQLite database."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/DatabaseWriter","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"DatabaseWriter"}],"url":"\/documentation\/grdb\/databasewriter"}}}