Is it possible to upload a video into an SQLite DB (not just the URL)? I have tried it but have not found success; if any one knows the solution, please post the answer.
It won't be the exact answer for this question. But I would like to give solution. You can save the video in documents directory as a file format. And insert the file name in your SQLITE database.
And whenever you want to access the video, you can do easily by querying the file name.
As SQLITE is a low-weight database & thus it won't be recommended to add heavy load on it.
It sounds like a bad idea to store big files in a SQL database, especially SQLite. If you really need to do it, make sure to use a BLOB column and to escape your data correctly.
It is a really bad practice to try to store large binary data in a database, you are much better off storing the video on the phone and the location of the video in the database. This will drastically improve your speed in opening the file since a file lookup on the iPhone is much faster than pulling all of those bytes from the database.
NSData *imgData;
imgData = [[NSData alloc] initWithContentsOfURL:
[NSURL URLWithString:[aDict objectForKey:@"Icon"]]];
if (sqlite3_prepare_v2(database, sqlStatement1, -1,
&compiledStatement1, NULL) == SQLITE_OK)
{
sqlite3_bind_blob(compiledStatement1, 1, [imgData bytes],
[imgData length], SQLITE_TRANSIENT);
}
if ([[aDict objectForKey:@"Icon"] length] > 0)
{
[imgData release];
}