Hello Igor,
        I tried what u suggested me,I got a compiler error cannot convert
const void * to void* .

I am storing string as blob because I want hide my data from others I am
writing an application which works on portable apps in my apps I am using
sqlite if any one opens the database using tools available in the internet
any one can view my data i.e. what I am carrying so I am avoiding this by
storing it using blob.

Can you please help in converting this i.e. const void * to CString or tell
me any other way to hide my data from others (the operation should not be
time consuming)

Regards,
G.Satish

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Thursday, April 02, 2009 4:57 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Converting BLOB Data type to String

"SATISH" <g.satis...@gmail.com> wrote in
message news:49d4529b.034c6e0a.2f1d.0...@mx.google.com
>        I have written a string into database by converting into "BLOB
> Data Type".writing into database is Ok I got a problem when reading
> from the database to read a blob from the database I am using the
> function "const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);"
> this functions returns me const void * where I want to convert this
> into "CString".please any one of you can help me in  converting const
> void * to CString.

Try this:

void* data = sqlite3_column_blob(my_stmt, col_no);
int size = sqlite3_column_bytes(my_stmt, col_no);
CString str(static_cast<char*>(data), size);

But why do you store your string as BLOB, and not as text, in the first 
place?

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to