On Mon, Nov 7, 2011 at 11:18 AM, Pavel Ivanov <paiva...@gmail.com> wrote:
> > What is the "page size"? Aren't sqlite dbs portable to any > platform/processor? Could it be that sqlite installed on my 64-bit machine > is writing a 64-bit db, but our app and the sqlite3 lib is only 32-bit? > Seems like any good file format wouldn't care about that and knows how to > read/write the same no matter what. > > You understand correctly that SQLite database is portable and doesn't > depend on platform bitness or anything like that. Page size is (to > explain it roughly) size of elementary data block in the database > file. You can see this size using "pragma page_size" (see > http://www.sqlite.org/pragma.html#pragma_page_size). At the time of > database creation you can change page size using the same pragma > statement. And I believe the only time when page size matters (besides > some performance considerations) is in this backup API your app uses. > So to fix your problem you need to issue a correct "pragma > page_size=..." statement at the time of creation of the database > (probably in-memory one). > Right. So I think what you need to do is to first "PRAGMA page_size" on the read-only disk database to find out what the page size is there. Then "PRAGMA page_size=N" (substituting an appropriate N) as the very first thing you do on the in-memory database. Then the backup should just work. > > > Pavel > > > On Mon, Nov 7, 2011 at 10:59 AM, Mills, Steve <smi...@makemusic.com> > wrote: > > I've inherited some python and sqlite work and am trying to figure it > out. I've done neither before, so be kind. > > > > There are some python scripts that generate a sqlite db, then our app > has uses sqlite3 code library to read that db and copy it to a memory-based > db (I assume so we can make changes to it and perhaps write it out to a > different file, or at least prevent the source db from being changed). When > I do the copy (which calls sqlite3_backup_step(dest, -1)), it returns 8 > (SQLITE_READONLY). > > > > I see some documentation in sqlite3.h that says it might return > SQLITE_READONLY if "The destination database is an in-memory database and > the destination and source page sizes differ." > > > > What is the "page size"? Aren't sqlite dbs portable to any > platform/processor? Could it be that sqlite installed on my 64-bit machine > is writing a 64-bit db, but our app and the sqlite3 lib is only 32-bit? > Seems like any good file format wouldn't care about that and knows how to > read/write the same no matter what. > > > > Any help would be greatly appreciated. Thanks! > > > > -- > > Steve Mills > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users