SQLite Forum

doc: prepare.html: nByte performance advantage?
Login
Thank you for responding, Larry.

Re the plurality issue: I'm sorry for not making myself clear and for not including the other reason I thought of. I meant that all occurrences of nByte in the doc page prepare.html should be changed to nBytes. Yes, I agree that the doc is consistent and correct the way it is, but I think nBytes is a bit more clear than nByte, not only because nBytes matches the name used in the source code but also because nBytes seems to be an abbreviation for the "number of bytes", not the "number of byte" or the "n<sup>th</sup> byte". I imagine nByte was updated to nBytes in the source code for this reason (and that the doc is outdated).

Re code paths: Yes, I see that too. And do you see that the same code path is taken whether nBytes is -1 or whether nBytes is the number of bytes in zSql plus one? Here's how I see it: If nBytes is -1, then `nBytes>=0` is false. And if, eg, zSql is "SELECT 1" and nBytes is 9 (since the number of characters in "SELECT 1" is 8 plus 1 to include the null character), then `zSql[nBytes-1]!=0` is false. So in either case the else block is executed. If my logic is correct, then maybe the doc sentence I quoted above should be removed or clarified.

Re the typo: Yeah, maybe "nul-terminator" should be "null terminator". And for consistency, maybe "zero terminator" should be "null terminator" and "nul-terminated" should be "null-terminated". I think there's supposed to be a space when it's used as a noun and a hyphen when it's used as an adjective.