Blob Data Type?

4 Solutions Collect From Internet About “Blob Data Type?”

Storing video in a SQLite database is a horrible idea. Don’t do it.

Don’t put large BLOBs in a database. Put them in the filesystem next to your database file and then write the filenames or an URL to the database. This will be a ton faster, will use the database much more efficiently, will minimize I/O (in that the video won’t have to be broken up into the paging scheme of the database, and will make management of the videos easier (a filesystem delete of a file is a ton faster than a database having to excise a bunch of pages that contain the BLOB).

Putting BLOBs in the database is horribly inefficient and, quite possibly, will blow out your app’s memory use, too (unless you have figured out a way to stream data from the database to the video decoder).

It will incur extra I/O, use more power, and performance will generally go to hell as you store more items in the database. If you are mixing BLOBs with small datums in the database, you can quite easily end up with a pathologically fragmented database. Auto-vacuuming will help, but it is yet more inefficiency, more I/O and more battery life consumed.


Yes, there are databases that handle BLOBs fairly well. And they are completely irrelevant to this question whose only tag is “iPhone”.

Note that the answer to the question “handles BLOBs and streaming media better than the filesystem” pretty much always requires that you are using a database that is reading/writing to/from a raw device — a partition on a hard drive that is nothing but database contents. Any other solution will necessarily be a layer on top of an existing filesystem and there will be cost, even if the database vendor has done all the engineering work (and it is huge) to match they database access I/O as much as possible with underlying filesystem semantics.

The blob data type can be used to store any binary data. Specifically it stands for B(inary) L(arge) Ob(ject) (http://en.wikipedia.org/wiki/Blob_(computing))

NSData *imageData;
NSURL *imageURL = [[NSURL alloc] initWithString:[[videolistArray objectAtIndex:[number intValue]] valueForKey:@"video"] ];
if (imageURL) {
    imageData = [NSData dataWithContentsOfURL:imageURL];
}

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

if (!documentsDirectory) {
    NSLog(@"Documents directory not found!");
}
NSArray *myWords = [[NSString stringWithFormat:@"%@",[[videolistArray objectAtIndex:[number intValue]] valueForKey:@"video"]] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];

NSString *appFile = [documentsDirectory stringByAppendingPathComponent:[myWords lastObject]];

[imageData writeToFile:appFile atomically:YES];

In This i store video in iphone document directory u just insert it into SQLite Data base w

I use blog to store video in my SQLite DataBase and its working good,i have store more then 100 video in my database its take time to store that video