hi all i have a question regarding Blobs, that is
storing images into the database. 

my image by default is an unsigned short array and to
bind blobs it wants a byte array. i am not sure i am
doing this right at all. is there a universal cross
platform way for this easy conversion? 

so far the code i have is:
.........
char *byteArray = (char *) malloc((size * 2) *
sizeof(char));
.........

for(unsigned int i = 0; i < index < size; i++)
{
 byteArray[2 * index] = (char)buffer[index];
 byteArray[(2 * index) + 1] = ( (char) buffer[index]
>> 1);

then i prepare the statement which is successful then:

status = sqlite3_bind_blob(statement, 1, byteArray,
size * 2, free);

some questions i have: i get an error of '25' back
from status and looking on the sqlite documention it
says the 2nd parameter to sql bind was out of range. i
have no idea how the 2nd parameter can be out of
range. 

my next question is once you have the blob in the
database how in the world do you read it back out? of
course when i do read it back out i will need to
convert it back to a short array to be able to use it.


i am using C++(g++ compiler) on linux. thanks in
advance! 


      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to