AlexDenisov / iActiveRecord

ActiveRecord for iOS without CoreData, only SQLite
http://alexdenisov.github.com/iActiveRecord/
MIT License
354 stars 50 forks source link

I could not get data from blob field #5

Closed lyrata closed 11 years ago

lyrata commented 12 years ago

I have a database,the database schema is : create table "card"(id integer primary key unique , "title" text, "type" text, "body" blob,"updatedAt" INTEGER, "createdAt" INTEGER) ,and body field already has some of the binary data. I copy the database to the Documents. Here is my code: @property (nonatomic, retain) NSData body; NSArray cards = [Card allRecords]; Card *card = [cards first]; NSLog(@"%@",card.title); NSLog(@"%@",card.body);

I can get the title,but the body is nil

AlexDenisov commented 12 years ago

Thank you for feedback. I will provide solution as soon as possible.

AlexDenisov commented 12 years ago

I have researched this problem and found a bug and a big miscalculation. As a hotfix I decided to store the blob data encoded to Base64. Now I am working on correcting framework's logic. Sorry, but unfortunately, you have to either wait or find another solution.

lyrata commented 12 years ago

Thank you for your reply. I used sqlitepersistentobjects(http://code.google.com/p/sqlitepersistentobjects/) for sqlite. It store the binary for blob data.

Why must all data be the string in sqlite with IActiveRecord?

AlexDenisov commented 12 years ago

Because I use sqlite3_exec instead prepare/bind/step.

AlexDenisov commented 11 years ago

Implemented at a4cd698d8da5131451f4ba46c8ff2e6af87f94d2