On Wed, Mar 17, 2010 at 04:36:02PM -0400, Pavel Ivanov scratched on the wall:
> > ?You can't do pointer math with values returned by strlen().
> 
> BTW, I see that SQLite has sqlite3_value_text() function but has no
> sqlite3_value_text_len() function. Is it explicitly mentioned
> somewhere that '\0' bytes in the middle of the text are prohibited? It
> seems that sqlite3_bind_text() doesn't put that kind of restriction.

  sqlite3_value_text() always returns UTF8.  UTF8 cannot contain a
  zero-valued byte that is not a zero-valued character.

  I think you're actual question is if zero-characters are prohibited,
  and I think the answer is no.

  Values returned by _text() are always zero-terminated, but I'm not
  sure there is anything stopping you from entering a string with a
  null character in the middle (assuming you pass in an explicit
  length to sqlite3_bind_text()).  In any event, you can use
  sqlite3_value_bytes() to find out the length of the text value
  returned.  That is, however BYTES, not CHARACTERS.

   -j

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

"Our opponent is an alien starship packed with atomic bombs.  We have
 a protractor."   "I'll go home and see if I can scrounge up a ruler
 and a piece of string."  --from Anathem by Neal Stephenson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to