I'm using sqlite in my program. To save NSData I'm using this:
sqlite3_bind_blob(addStmt, 5, somedata, -1, SQLITE_TRANSIENT);
And getting it back like this:
NSData *data = [[NSData alloc] initWithBytes:sqlite3_column_blob(selectstmt, 4) length:sqlite3_column_bytes(selectstmt, 4)];
But when I'm trying to see data:
NSLog(@"%@", data);
It's returning: <84fa8801 0200>
Please help me to convert it to real NSData..
I'm pretty sure
NSLog(@"%@", data);
is just printing out the memory address of the NSData
object. I think you're looking for something like this:
NSString *stringData = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];
This will give you the data contained at the current row in the first cell as an NSString
.