On Sat, May 22, 2010 at 05:27:24AM -0700, shion scratched on the wall:
> Hello,
> I already found a lot of threads about the UTF16 topic, but I couldn't solve
> my problem.
> I have the following source code:
> sqlite3_open_v2("test.sqlite", &Database, SQLITE_OPEN_READWRITE |
> sqlite3_exec(Database, "PRAGMA encoding = \"UTF-16\"", 0, 0, 0);
> sqlite3_prepare16_v2(Database, L"CREATE TABLE user (userID INTEGER NOT NULL
> PRIMARY KEY, lastName VARCHAR(50), firstName VARCHAR(50));", -1,
> &pStatement, 0);
> std::cout << sqlite3_errmsg(Database) << std::endl;
> The result is:
> near "C": syntax error

  Compile or runtime?  Runtime, I assume.

> I know that the SQL syntax is correct and it is possible to execute that
> source under windows.
> I don't understand why it doesn't work with Linux.
> Does somebody has an idea what's going wrong?

  Wide characters are 32 bits on most non-Windows platforms.  When
  passed to a 16 bit system, the first character of L"CREATE..." is
  seen as ['C', '\0'].


  This is part of the reason SQLite3 uses void* rather than wchar_t*
  for UTF-16 strings.


Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
sqlite-users mailing list

Reply via email to