hi all - i am trying once again to insert an image(an
array of shorts) into a blob. 

i created a table that is described as such:

CREATE TABLE Images{
imageID integer primary key,
imageData text not null);

#1 - is text ok here for a blob? maybe not - this may
be my entire problem. 

anyway instead of using data in an image i just made
an array of unsigned shorts and filled it. a size of
10. 

so here is what i am doing in the code. imageArray
holds the unsigned shorts(there are 10 of them)

char* blob = reinterpret_cast<char*>(imageArray);

string myString = "insert into Images(ImageID,
imageData) values(?, 'blob')";

//then i want to try to prepare the statement:

int status = sqlite3_prepare_v2(db, myString.c_str(),
-1, &statement, NULL);
if( (status != SQLITE_OK) || (statement == NULL))
  cout << "Error preparing SQL Statement" << endl;


//now i would like to bind the blob:

status = sqlite3_bind_blob(statement, 1, imageArray,
10 * sizeof(unsigned short), SQLITE_TRANSIENT);


//execute statement for each row??
while( (status = sqlite3_step(statement)) ==
SQLITE_ROW);

//free the prepared statement
status = sqlite3_finalize(statement);
if(status != SQLITE_OK)
  cout << "Error deleting prepared SQL statement" <<
endl;
=====================================================

i actually get the last status check output, saying
that there was an error deleting the statement. when i
looked that up it says there was a problem with the
prepare statement being successful or nothing happens
at all when clearly i did and clearly the status was
ok too since i didnt get an error message there. 

can anyone help me out as to what might be going on
here? thanks so much in advance 

-sincerely c.s. (SQL noob)...






      
____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to