Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 669801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:11:26+00:00 2026-05-14T00:11:26+00:00

I am attempting to store NSMutableDictionaries as a blobs in sqlite, by first converting

  • 0

I am attempting to store NSMutableDictionaries as a blobs in sqlite, by first converting it into NSData via either NSPropertyListSerialization or NSKeyedArchiver.

When I store the blob, the NSData object’s length is in the thousands (KB range). When I get it back, it’s been truncated to 10 bytes. When I check the DB through SQLite Browser, most of the data is gone (I can recognize the keys in the record if I store the dictionary as NSPropertyListSerialization, but the values of the dictionary are gone). This happens regardless of whether I use NSPropertyListSerialization or NSKeyedArchiver to serialize my data.

NSMutableDictionary* item = [items objectAtIndex:i];
NSData *dictionary  = [NSKeyedArchiver archivedDataWithRootObject:item];
sqlite3_bind_blob(  compiledStatement, 5, [dictionary bytes], [dictionary length], SQLITE_TRANSIENT);

This is actually a snippet from my code, the complete section of which I posted in another related question.

Bulk inserts into sqlite db on the iphone

Checking the value of [dictionary length] using gdb or NSLog yields the same result: The data length is in the KB range.

When I check retrieve the data later on:

NSData* raw = [[NSData alloc] initWithBytes:sqlite3_column_blob(compiledStatement, 1) length:sqlite3_column_bytes(compiledStatement, 1)];
[raw release];

Checking [raw length] gives me a mere 10 bytes. This is true for every instance of data that I’ve attempted to store in this column, whatever their starting size might be, they end up 10 bytes in the end. There’s nothing wrong with my retrieval query. I’ve run it in the command line and in SQL Browser, and I am getting the correct records and columns, but the data that’s been stored in the record for this specific column is incorrect.

What’s happened to the rest of my data? Is there something wrong with the way I’m using sqlite3_bind_blob? I’ve checked the sqlite documentation for terminating characters or max size limits. My data is well within the maximum size of a blob entry, and I can find no information on terminals that might cut my data to size.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:11:27+00:00Added an answer on May 14, 2026 at 12:11 am

    I’ve found the perpetrator in this wild good chase… I was taking the value of column 1 instead of column 0, which was the actual column that contained my data. I assumed that since binding values to your query starts at column 1, retrieving columns from query results would also start at 1. My mistake.

    The 10 bytes per row were in fact NOT my dictionary data, but the timestamp I was using to sort my results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to store the value 0.9999 into an mpfr_t variable using the mpfr_set_str()
using iphone sdk 4.o. I am attempting to store around 10 NSTimer object in
Im attempting to store json objects in a cookie, but im running into a
Attempting to insert an escape character into a table results in a warning. For
I am attempting to store the change made to my application's properties. The .properties
I am attempting to store a variable length number that can have leading zeros
I am attempting to store a list of commands to send down a serial
I am attempting to store the date in a variable using getdate(). What am
I'm a php noob attempting my first shopping cart. I intend to use paypal
I'm attempting to store 3 values in a database I've created on an android

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.