> err = sqlite3_prepare16_v2(m_dbh, stmt.m_sql.c_str(), -1, &stmt.m_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 wrote.

I think there's some encoding conversion on the way to this function
call, so that stmt.m_sql (or the output of stmt.m_sql.c_str() ) is not
actually in UTF-16. Do you see the string contents in debugger?


Pavel


On Mon, Nov 7, 2011 at 1:19 PM, Mills, Steve <smi...@makemusic.com> wrote:
> 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:", &m_dbh, flags, NULL);
>
> // stmt.m_sql is a UTF16 string: "PRAGMA page_size = ?". It will
> // bind the actual value (4096) to the ? later.
> err = sqlite3_prepare16_v2(m_dbh, stmt.m_sql.c_str(), -1, &stmt.m_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 wrote.
>
> --
> Steve Mills
> office: 952-818-3871
> home: 952-401-6255
> cell: 612-803-6157
>
> _______________________________________________
> 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

Reply via email to