Class/Object

com.github.sqlite4s

SQLiteBackup

Related Docs: object SQLiteBackup | package sqlite4s

Permalink

class SQLiteBackup extends Logging

SQLiteBackup wraps an instance of SQLite database backup, represented as sqlite3_backup* in SQLite C API. Usage example:

SQLiteBackup backup = connection.initializeBackup(new File("filename"));
try {
while (!backup.isFinished()) {
    backup.backupStep(32);
}
} finally {
  backup.dispose();
}
Unless a method is marked as thread-safe, it is confined to the thread that has opened the connection to the source database. Calling a confined method from a different thread will result in exception.

See also

SQLiteConnection#initializeBackup

Using the SQLite Online Backup API

SQLite Online Backup API

Linear Supertypes
Logging, LazyLogging, LoggerHolder, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SQLiteBackup
  2. Logging
  3. LazyLogging
  4. LoggerHolder
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def backupStep(pagesToBackup: Int): Boolean

    Permalink

    Copy up to pagesToBackup pages from source database to destination.

    Copy up to pagesToBackup pages from source database to destination. If pagesToBackup is negative, all remaining pages are copied.

    If source database is modified during backup by any connection other than the source connection, then the backup will be restarted by the next call to backupStep. If the source database is modified by the source connection itself, then destination database is be updated without backup restart.

    pagesToBackup

    the maximum number of pages to back up during this step, or negative number to back up all pages

    returns

    true if the backup was finished, false if there are still pages to back up

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    SQLiteBusyException if SQLite cannot establish SHARED_LOCK on the source database or RESERVED_LOCK on the destination database or source connection is currently used to write to the database. In these cases call to backupStep can be retried later.

    SQLiteException if SQLite returns an error or if the call violates the contract of this class

    See also

    sqlite3_backup_step

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def dispose(): Unit

    Permalink

    Disposes this backup instance and connection to the destination database.

    Disposes this backup instance and connection to the destination database.

    This is a convenience method, equivalent to dispose(true).

    See also

    #dispose(boolean)

  8. def dispose(disposeDestination: Boolean): Unit

    Permalink

    Dispose this backup instance and, if disposeDestination is true, dispose the connection to the destination database as well.

    Dispose this backup instance and, if disposeDestination is true, dispose the connection to the destination database as well.

    You might want to pass false to this method to subsequently call #getDestinationConnection() and perform any actions on the fresh backup of the database, then dispose it yourself.

    disposeDestination

    if true, connection to the destination database will be disposed

  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def getDestinationConnection(): SQLiteConnection

    Permalink

    Returns connection to the destination database, that was opened by com.almworks.sqlite4java.SQLiteConnection#initializeBackup.

    Returns connection to the destination database, that was opened by com.almworks.sqlite4java.SQLiteConnection#initializeBackup.

    Important! If you call this method, you should be careful about disposing the connection you got. You should only dispose it after disposing SQLiteBackup instance, otherwise the JVM might crash.

    returns

    destination database connection

  14. def getPageCount(): Int

    Permalink

    Returns the total number of pages in the source database.

    Returns the total number of pages in the source database.

    returns

    total number of pages to back up

    Annotations
    @throws( ... )
    Exceptions thrown

    SQLiteException if called from a different thread or if source or destination connection are disposed

    See also

    SQLite Online Backup API

  15. def getRemaining(): Int

    Permalink

    Returns the number of pages still to be backed up.

    Returns the number of pages still to be backed up.

    returns

    number of remaining pages

    Annotations
    @throws( ... )
    Exceptions thrown

    SQLiteException if called from a different thread or if source or destination connection are disposed

  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. def isFinished: Boolean

    Permalink

    Checks whether the backup was successfully finished.

    Checks whether the backup was successfully finished.

    returns

    true if last call to { @link #backupStep} has returned true.

  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. lazy val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    LazyLogging → LoggerHolder
  20. final val loggerName: String

    Permalink
    Attributes
    protected
    Definition Classes
    LoggerHolder
  21. val myDestination: SQLiteConnection

    Permalink
  22. var myDestinationController: SQLiteController

    Permalink
  23. var myHandle: Handle

    Permalink
  24. val mySource: SQLiteConnection

    Permalink
  25. var mySourceController: SQLiteController

    Permalink
  26. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    SQLiteBackup → AnyRef → Any
  31. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Logging

Inherited from LazyLogging

Inherited from LoggerHolder

Inherited from AnyRef

Inherited from Any

Ungrouped