I encountered a documentation issue at the page that describes how to define
new collating sequences ( https://www.sqlite.org/c3ref/create_collation.html )
For the 3 variants of sqlite3_create_collation the 5th argument is a function
called "xCompare", but the text refers to "xCallback" instead of "xCompare":
"The fifth argument, xCallback, is a pointer to the collating function.
[...]"
Please correct this.
Furthermore the text states:
"The collating function callback is invoked with a copy of the pArg
application data pointer and with two strings in the encoding specified by the
eTextRep argument"
But function xCompare is defined as "int(*xCompare)(void*,int,const
void*,int,const void*)", so having 2 additional integer parameters. These will
contain the lengths of the two strings but this is not documented. At first I
guessed they would contain one of the type constants (see
https://www.sqlite.org/c3ref/c_blob.html) to allow collation implementations
like the built-in one where integer < text < blob.
But now I see that lengths are necessary, especially with blobs that can
contain embedded NUL characters. I guess this also means that I cannot assume
that the strings are nul-terminated.
Please document that the integers arguments contain the lengths of the strings.
Btw. I expected "xCompare" to have signature int(*xCompare)(void*, const
sqlite3_value * const, const sqlite3_value * const). Can anyone explain why the
values are passed as strings. E.g. were collating sequences only foreseen for
text values?
Regards,
Rob Golsteijn
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users