Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread C. Smith
> > That was it! It seems to work now. > > // new code > int r = _wcsnicmp((const wchar_t *)a, (const wchar_t *)b, > ((alen < blen) ? alen : blen) / sizeof(wchar_t)); > > Is the fact that the callback strings are not NUL terminated and the > lengths are in bytes documented anywhere? If

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread C. Smith
>>> int r = _wcsnicmp((const wchar_t *)a, (const wchar_t *)b, >>> (alen < blen) ? alen : blen); > > Maybe the length is still wrong. The lengths passed to an sqlite > collation sequence callback are in bytes. But _wcsnicmp() is > probably in characters, no? > > That was it! It seems to

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread Dan
On Jul 21, 2008, at 8:10 PM, D. Richard Hipp wrote: > > On Jul 21, 2008, at 8:32 AM, C. Smith wrote: >> >> I didn't know the strings weren't nul terminated. I changed my >> callback to: >> >> static int _cmp(void *pCtx, int alen, const void *a, >> int blen, const void *b) >> { >> int r =

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread C. Smith
> > How did you register the collating sequence? Did you use the > SQLITE_UTF16_ALIGNED argument on the 3rd parameter? > I am doing the below. sqlite3_create_collation(db, "PATH", SQLITE_UTF16, NULL, _cmp); I changed it to use "SQLITE_UTF16_ALIGNED" but it didn't load properly. I

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread D. Richard Hipp
On Jul 21, 2008, at 8:32 AM, C. Smith wrote: > > I didn't know the strings weren't nul terminated. I changed my > callback to: > > static int _cmp(void *pCtx, int alen, const void *a, > int blen, const void *b) > { > int r = _wcsnicmp((const wchar_t *)a, (const wchar_t *)b, > (alen <

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread C. Smith
D. Richard Hipp wrote: > On Jul 21, 2008, at 12:05 AM, C. Smith wrote: > >> The collation is >> a case-insensitive wchar compare for windows (using _wcsicmp). > > The strings passed to a collating function are not zero-terminated. > Are you making a copy of both input strings and adding a

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread C. Smith
Robert Simpson wrote: > I just tried the same steps on a memorydb using the NOCASE collation > sequence, and it worked fine ... > > > C:\Src>sqlite3 :memory: > SQLite version 3.6.0 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> .headers on > sqlite>

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread cstrader
uot;D. Richard Hipp" <[EMAIL PROTECTED]> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> Sent: Monday, July 21, 2008 7:18 AM Subject: Re: [sqlite] User-defined collation UNIQUE INDEX > > On Jul 21, 2008, at 12:05 AM, C. Smith wrote: > >&g

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-21 Thread D. Richard Hipp
On Jul 21, 2008, at 12:05 AM, C. Smith wrote: > The collation is > a case-insensitive wchar compare for windows (using _wcsicmp). The strings passed to a collating function are not zero-terminated. Are you making a copy of both input strings and adding a zero terminator yourself, or are

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-20 Thread Robert Simpson
'); SQL error: column myvalue is not unique -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of C. Smith Sent: Sunday, July 20, 2008 9:52 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined collation UNIQUE INDEX No, assigning collati

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-20 Thread C. Smith
No, assigning collation during index creation makes no difference. I also tried REINDEX with no luck. I am using verison 3.5.9 on a winxp box (forgot to mention that). csmith Robert Simpson wrote: > Does this work? > > CREATE UNIQUE INDEX myidx ON test(str COLLATE path); > > Robert > >

Re: [sqlite] User-defined collation UNIQUE INDEX

2008-07-20 Thread Robert Simpson
Does this work? CREATE UNIQUE INDEX myidx ON test(str COLLATE path); Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of C. Smith Sent: Sunday, July 20, 2008 9:05 PM To: sqlite-users@sqlite.org Subject: [sqlite] User-defined collation UNIQUE INDEX