1
A
回答
1
有两个思想流派
- 把它们放在一个目录,然后存储在文本字段
- 存储的路径在BLOB字段
如果图像数据数据库非常大,并且图像也是如此,那么文件系统的方式更加高效。
如果您只是想快速完成某些操作,请使用blob。没关系,但不能缩放。
1
对于细节如下网站: http://blog.developeronhire.com/create-sqlite-table-insert-into-sqlite-table/
<script type="text/javascript">
function createDatabase(){
try
{
if(window.openDatabase)
{
var shortName = 'db_edentiti';
var version = '1.0';
var displayName = 'Edentiti Information';
var maxSize = 65536; // in bytes
db = openDatabase(shortName, version, displayName, maxSize);
}
} catch(e) {
alert(e);
}
}
function executeQuery($query,callback){
try
{
if(window.openDatabase){
db.transaction(
function(tx){
tx.executeSql($query,[],function(tx,result){
if(typeof(callback) == "function"){
callback(result);
}else{
if(callback != undefined){
eval(callback+"(result)");
}
}
},function(tx,error){});
});
return rslt;
}
} catch(e){}
}
function createTable(){
var sql = 'drop table image';
executeQuery(sql);
var sqlC = 'CREATE TABLE image (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, image BLOB)';
executeQuery(sqlC);
}
function insertValue(){
var img = document.getElementById('image');
var sql = 'insert into image (name,image) VALUES ("sujeet","'+img+'")';
executeQuery(sql,function(results){alert(results)});
}
<input type="button" name='create' onClick="createDatabase()" value='Create Database'>
<input type="button" name='create' onClick="createTable()" value='create table'>
<input type="button" name='insert' onClick="insertValue()" value='Insert value'>
<input type="button" name='select' onClick="showTable()" value='show table'>
<input type="file" id="image" >
<div result></div>
相关问题
- 1. 插入图像到sqlite的iphone
- 2. 插入和显示图像在SQLite的
- 3. 如何在sqlite中插入图像?
- 4. 从URL插入图像到Sqlite表
- 5. 无法插入图像插入分贝SQLITE
- 6. Android - 插入图像的位图阵列到SQLite数据库
- 7. 插入SQLite的
- 8. 如何插入图像/斑点到SQL Server CE(就像sqlite)?
- 9. 插入图像
- 10. Android的插入图像插入的EditText
- 11. 如何在iphone中的sqlite数据库中插入图像
- 12. 如何在Android中将图像的uri插入sqlite数据库?
- 13. 如何从uitextfield插入值也是在sqlite中的图像?
- 14. SQLite的不插入
- 15. Azure SQLite插入
- 16. 插入SQLite中
- 17. 插入SQLite
- 18. Android的SQLite的插入不插入
- 19. PDF.js插入图像
- 20. 插入图像failes
- 21. 插入图像(Tkinter)
- 22. TinyMCe插入图像
- 23. 插入图像onCloseDocument
- 24. TinyMce插入图像
- 25. SQLite - 如何从XML文件插入JPG图像(使用Delphi 2009)
- 26. 通过JSP表格在SQLite数据库中插入图像
- 27. 如何从sqlite数据库插入和检索图像?
- 28. Phonegap将照片和插入图像(BLOB)到数据库SQLite
- 29. 插入和SQLite中检索BLOB图像与HTML5和JavaScript
- 30. Android:压缩并插入图像到SQLite数据库
我知道,但我不会说,直到你接受一些答案。 (当答案满足你的问题时,你可以点击旁边的绿色勾号。) – 2010-11-28 03:50:14
@Marcelo:出于好奇,为什么? – Mark 2010-11-28 04:06:56