FMDatabase+InMemoryOnDiskIO.h 985 B

1234567891011121314151617181920212223242526
  1. //
  2. // FMDatabase+InMemoryOnDiskIO.h
  3. // FMDB
  4. //
  5. // Created by Peter Carr on 6/12/12.
  6. //
  7. // I find there is a massive performance hit using an "on-disk" representation when
  8. // constantly reading from or writing to the DB. If your machine has sufficient memory, you
  9. // should get a significant performance boost using an "in-memory" representation. The FMDB
  10. // warpper does not contain methods to load an "on-disk" representation into memory and
  11. // similarly save an "in-memory" representation to disk. However, SQLite3 has built-in
  12. // support for this functionality via its "Backup" API. Here, we extend the FMBD wrapper
  13. // to include this functionality.
  14. //
  15. // http://www.sqlite.org/backup.html
  16. #import "FMDatabase.h"
  17. @interface FMDatabase (InMemoryOnDiskIO)
  18. // Loads an on-disk representation into memory.
  19. - (BOOL)readFromFile:(NSString*)filePath;
  20. // Saves an in-memory representation to disk
  21. - (BOOL)writeToFile:(NSString *)filePath;
  22. @end