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的
- 2. 从URL插入图像到Sqlite表
- 3. Android - 插入图像的位图阵列到SQLite数据库
- 4. 插入SQLite的
- 5. 插入图像
- 6. Android的插入图像插入的EditText
- 7. 如何在iphone中的sqlite数据库中插入图像
- 8. 如何从uitextfield插入值也是在sqlite中的图像?
- 9. 如何在Android中将图像的uri插入sqlite数据库?
- 10. SQLite的不插入
- 11. 插入SQLite
- 12. 插入SQLite中
- 13. TinyMce插入图像
- 14. 插入图像onCloseDocument
- 15. TinyMCe插入图像
- 16. 插入图像(Tkinter)
- 17. PDF.js插入图像
- 18. Android的SQLite的插入不插入
- 19. 插入和SQLite中检索BLOB图像与HTML5和JavaScript
- 20. Android:压缩并插入图像到SQLite数据库
- 21. 如何将图像插入到sqlite数据库?
- 22. iTextSharp的 - 插入图像
- 23. 如何插入图像插入在Java
- 24. 如何插入sqlite视图工作?
- 25. 如何将位图图像插入到Windows Phone 8.1上的sqlite数据库c#
- 26. SQLite Java JDBC插入
- 27. 将unicode插入sqlite?
- 28. SQLITE - 插入问题
- 29. SQLite插入性能
- 30. SQLite插入问题
我知道,但我不会说,直到你接受一些答案。 (当答案满足你的问题时,你可以点击旁边的绿色勾号。) – 2010-11-28 03:50:14
@Marcelo:出于好奇,为什么? – Mark 2010-11-28 04:06:56