如何在SQLite DB中存储图像 [英] How to store image in SQLite DB

查看:122
本文介绍了如何在SQLite DB中存储图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在sqlite db中存储图像。有人可以建议怎么做。



Regds

SNI

Hi,

I want to store images in sqlite db. Can someone suggest how to do it.

Regds
SNI

推荐答案

图像存储在大多数数据库中,包括SQLite,作为所谓的BLOB(二进制大对象)。因此,创建一个表,其中一列具有数据类型BLOB。其他列可以是图像名称,图像数据等。



有关如何使用BLOB填充和读取表的示例,请参阅此示例: http://stackoverflow.com/questions/625029/如何从-sqlite中存储和检索blob [ ^ ]



我建议读一个有关SQLite的教程首先是为了全面概述SQL命令的格式化和发送到数据库的方式,以及如何检索结果。
An image is stored in most databases, include SQLite, as a so-called BLOB (binary large object). So create a table that has one column being of datatype BLOB. The other columns could things like image name, image data, etc.

For an example on how to fill and read a the table with a BLOB see this example here:http://stackoverflow.com/questions/625029/how-do-i-store-and-retrieve-a-blob-from-sqlite[^]

I would recommend reading one of the tutorials about SQLite first, in order to get a general overview on how SQL commands are formatted and sent to the database and how results are to be retrieved.


这篇关于如何在SQLite DB中存储图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆