本文介绍了将视频上传到SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将视频上传到SQLite数据库(而不仅仅是URL)?我已经尝试过,但没有找到成功;如果有人知道解决方案,请发布答案。

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.

推荐答案

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];
}

这篇关于将视频上传到SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 19:40