Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
On Nov 7, 2011, at 14:02:24, Mills, Steve wrote: > only works with the existing code WHEN Man, I can't type today. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ sqlite-users mailing list

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
On Nov 7, 2011, at 13:57:39, Scott Hess wrote: > Can't prepare and bind a PRAGMA command like that. You'll have to > construct the full text. Ah, there we go. Copying existing code only works with the existing code works. :) Thanks everybody! I wish all mailing lists were as responsive as

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Scott Hess
On Mon, Nov 7, 2011 at 9:02 AM, Mills, Steve wrote: >                if(pageSize > 0) { >                        SqliteStatement  cmd("PRAGMA page_size = ?", *this); > >                        cmd.BindToInt(1, syz); >                        cmd.Step(); >                }

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Pavel Ivanov
> err = sqlite3_prepare16_v2(m_dbh, stmt.m_sql.c_str(), -1, _stmt, NULL); > err -> SQLITE_ERROR > > If I manually set the string to "PRAGMA page_size = 4096", then it works. So > perhaps this code is doing it wrong. I copied an existing routine that > somebody else no longer with the company

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
I'm some progress, but not sure why the error is being returned below. const int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; const int result = sqlite3_open_v2(":memory:", _dbh, flags, NULL); // stmt.m_sql is a UTF16 string: "PRAGMA page_size = ?". It will // bind the actual value (4096)

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Simon Slavin
On 7 Nov 2011, at 5:22pm, Mills, Steve wrote: > On Nov 7, 2011, at 11:09:39, Simon Slavin wrote: > >> On 7 Nov 2011, at 5:02pm, Mills, Steve wrote: >> >>> SqliteStatement cmd("PRAGMA page_size", *this); >> >> This does not return a simple character string, but a table with one row and

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
On Nov 7, 2011, at 11:09:39, Simon Slavin wrote: > On 7 Nov 2011, at 5:02pm, Mills, Steve wrote: > >> SqliteStatement cmd("PRAGMA page_size", *this); > > This does not return a simple character string, but a table with one row and > one column. Might you have to extract the value from

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
On Nov 7, 2011, at 11:02:38, Mills, Steve wrote: > // Set its page size: > if(pageSize > 0) { > SqliteStatement cmd("PRAGMA page_size = ?", *this); > > cmd.BindToInt(1, syz); > cmd.Step(); >

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Simon Slavin
On 7 Nov 2011, at 5:02pm, Mills, Steve wrote: > SqliteStatementcmd("PRAGMA page_size", *this); This does not return a simple character string, but a table with one row and one column. Might you have to extract the value from that table ? Simon.

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
On Nov 7, 2011, at 10:29:25, Richard Hipp wrote: > 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

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Pavel Ivanov
> 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 >

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Richard Hipp
On Mon, Nov 7, 2011 at 11:18 AM, Pavel Ivanov 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

[sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Mills, Steve
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