Re: [sqlite] Null character problem

2010-07-09 Thread Kavita Raghunathan
I'm apologise for the reminder, but I think I have become a victim of "thread takeover". Would someone please kindly answer my questions ? Kavita On 7/9/10 11:41 AM, "Kavita Raghunathan" wrote: > Thanks. Sounds like I have to use BLOBs which is not what I'm

Re: [sqlite] Null character problem

2010-07-09 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/09/2010 10:54 AM, Eric Smith wrote: > My question came purely from a mild curiosity. I was wondering about > the behavior of sqlite call sqlite3_bind_text when it is passed a range > of BYTES that includes nulls. bind_text and bind_blob use

Re: [sqlite] Null character problem

2010-07-09 Thread Virgilio Alexandre Fornazin
ite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Eric Smith Sent: sexta-feira, 9 de julho de 2010 14:54 To: General Discussion of SQLite Database Subject: Re: [sqlite] Null character problem Simo Slavin wrote: > (according to your earlier post) I'm not OP.

Re: [sqlite] Null character problem

2010-07-09 Thread Eric Smith
Simo Slavin wrote: > (according to your earlier post) I'm not OP. I'm Eric. OP was someone else. In this context, I don't care about blobs or about the right way of doing anything. > Read the documentation for memset(). I know quite well how memset works. I know character!=byte.

Re: [sqlite] Null character problem

2010-07-09 Thread H. Phil Duby
On Fri, Jul 9, 2010 at 10:48 AM, Eric Smith wrote: > Will sqlite3_bind_text work properly if the string contains (internal) > nulls?  What if I did something like: > > char zText[100]; > memset(zText, 0, sizeof(zText)); > sqlite3_bind_text(stmt, idx, zText, sizeof(zText),

Re: [sqlite] Null character problem

2010-07-09 Thread Simon Slavin
On 9 Jul 2010, at 5:48pm, Eric Smith wrote: > Simon Slavin wrote: > >> BLOBs can handle any sequences of bytes without problems, >> including nulls, ETX, and sequences which be illegal if they were used to >> express Unicode characters. You can put anything you like in a BLOB. > > I

Re: [sqlite] Null character problem

2010-07-09 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/09/2010 09:30 AM, Jay A. Kreibich wrote: > They can't be stored as text values without some type of encoding > (like base64), but they can be stored as BLOBs. Nulls can be stored in text values. Behind the scenes SQLite treats strings and

Re: [sqlite] Null character problem

2010-07-09 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/09/2010 09:24 AM, Kavita Raghunathan wrote: > 1. Is this an issue for storing in database ? If strcpy is used anywhere, > it would be a problem SQLite quite happily stores/retrieves null bytes in strings. It is part of my test suite. If

Re: [sqlite] Null character problem

2010-07-09 Thread Eric Smith
Simon Slavin wrote: > BLOBs can handle any sequences of bytes without problems, > including nulls, ETX, and sequences which be illegal if they were used to > express Unicode characters. You can put anything you like in a BLOB. I assume, due to the manifest typing semantics of the library,

Re: [sqlite] Null character problem

2010-07-09 Thread Simon Slavin
On 9 Jul 2010, at 5:29pm, Eric Smith wrote: > I have no specific knowledge on whether sqlite handles null characters > within the variables' values--but if I were a bettin man, I'd bet that > it handles them quite cleanly. You win. BLOBs can handle any sequences of bytes without problems,

Re: [sqlite] Null character problem

2010-07-09 Thread Jay A. Kreibich
On Fri, Jul 09, 2010 at 11:24:19AM -0500, Kavita Raghunathan scratched on the wall: > Hello, > I?m storing encrypted passwords in the sqlite database. The encryption > algorithm generates ?null? character, and therefore the password > strings can have nulls in them. > > 1. Is this an issue for

Re: [sqlite] Null character problem

2010-07-09 Thread Eric Smith
Kavita Raghunathan wrote: > sprintf(SqlStr, "INSERT INTO %s (AttrName, AttrEnum, AttrType, > AttrValue, ReadWrite, Entity_id) VALUES('%s', %d, %d, '%s', %d, > %d);", tbl_name, db[i]->attr_name, db[i]->attr_num, db[i]->attr_type, > db[i]->attr_value, db[i]->attr_src, entity_id); Don't do

[sqlite] Null character problem

2010-07-09 Thread Kavita Raghunathan
Hello, I’m storing encrypted passwords in the sqlite database. The encryption algorithm generates “null” character, and therefore the password strings can have nulls in them. 1. Is this an issue for storing in database ? If strcpy is used anywhere, it would be a problem 2. I’m using