我不知道我是对还是错.但据我所知,我无法手动创建版本更改事务.调用此方法的唯一方法是在打开索引数据库连接时更改版本号.如果这是正确的,在example1和example2中永远不会创建新的objectStore?
例1
function createObjectStore(name){
var request2 = indexedDB.open("existingDB");
request2.onupgradeneeded = function() {
var db = request2.result;
var store = db.createObjectStore(name);
};
}
Run Code Online (Sandbox Code Playgroud)
例题
function createObjectStore(name){
var request2 = indexedDB.open("existingDB");
request2.onsuccess = function() {
var db = request2.result;
var store = db.createObjectStore(name);
};
}
Run Code Online (Sandbox Code Playgroud)
示例3 - 这应该工作:
function createObjectStore(name){
var request2 = indexedDB.open("existingDB", 2);
request2.onupgradeneeded = function() {
var db = request2.result;
var store = db.createObjectStore(name);
};
}
Run Code Online (Sandbox Code Playgroud)
如果我想在一个数据库中创建多个objectStore,我怎么能在打开数据库之前获取/获取数据库版本?那么有没有办法自动化这个获取数据库版本号的过程?
除了使用onupgradeneeded事件处理程序之外,还有其他方法可以创建objectStore.
请帮忙.非常感谢.
编辑:
我遇到这个初学者问题,我不知道如何解决这个问题.这是我的代码:
worker( w1, d1, 2000 ) .
worker( w2, d1, 2500 ) .
worker( w2, d2, 1000 ) .
worker( w3, d2, 2000 ) .
worker( w4, d2, 4000 ) .
% worker( W, D, S ) means that worker W works in department D and has salary S
department( d1, w2 ) .
department( d2, w4 ) .
% department( D, B ) means that worker B is director of department D(this is not important in this case)
Run Code Online (Sandbox Code Playgroud)
我需要从部门中获得所有工资的总和,如下所示: …
以下是rss feed的示例:
<item>
<title>Stem cells being made from blood</title>
<description>A patient's own blood has been used to make personalised stem cells, which doctors hope can be used to treat a range of diseases.</description>
<link>http://www.bbc.co.uk/news/health-20539835#sa-ns_mchannel=rss&ns_source=PublicRSS20-sa</link>
<guid isPermaLink="false">http://www.bbc.co.uk/news/health-20539835</guid>
<pubDate>Fri, 30 Nov 2012 00:45:53 GMT</pubDate>
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" width="66" height="49" url="http://news.bbcimg.co.uk/media/images/64469000/jpg/_64469170_c0147104-red_blood_cells%2C_artwork-spl.jpg"/>
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" width="144" height="81" url="http://news.bbcimg.co.uk/media/images/64469000/jpg/_64469171_c0147104-red_blood_cells%2C_artwork-spl.jpg"/>
Run Code Online (Sandbox Code Playgroud)
我需要在媒体中获取.jpg图片的网址:缩略图..我怎么能用xpath或xquery做到这一点?有人可以帮我吗?谢谢!