質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -77,3 +77,101 @@
|
|
77
77
|
indexDataBase();
|
78
78
|
|
79
79
|
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```ここに言語を入力
|
84
|
+
|
85
|
+
問題点を検証するために作ったコード。
|
86
|
+
|
87
|
+
function indexDataBase(){
|
88
|
+
|
89
|
+
var indexedDB = window.indexedDB;
|
90
|
+
|
91
|
+
var request = null;
|
92
|
+
|
93
|
+
var db = null;
|
94
|
+
|
95
|
+
var store_01 = null;
|
96
|
+
|
97
|
+
var transaction_01 = null;
|
98
|
+
|
99
|
+
var titleIndex_01 = null;
|
100
|
+
|
101
|
+
var authorIndex_01 = null;
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
var store_02 = null;
|
106
|
+
|
107
|
+
var transaction_02 = null;
|
108
|
+
|
109
|
+
var titleIndex_02 = null;
|
110
|
+
|
111
|
+
var authorIndex_02 = null;
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
request = indexedDB.open('books', 1);
|
116
|
+
|
117
|
+
request.onupgradeneeded = function(){
|
118
|
+
|
119
|
+
db = request.result;
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
store_01 = db.createObjectStore('book_01', {keyPath:'isbn_01'});
|
124
|
+
|
125
|
+
titleIndex_01 = store_01.createIndex('by_title_01', 'title_01', {unique:false});
|
126
|
+
|
127
|
+
authorIndex_01 = store_01.createIndex('by_author_01', 'author_01');
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
store_02 = db.createObjectStore('book_01', {keyPath:'isbn_01'});
|
132
|
+
|
133
|
+
titleIndex_02 = store_02.createIndex('by_title_02', 'title_02', {unique:false});
|
134
|
+
|
135
|
+
authorIndex_02 = store_02.createIndex('by_author_02', 'author_02');
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
store_01.put({title_01:'Quarry Memories_01', author_01:'Fred_01', isbn_01:123456_01});
|
142
|
+
|
143
|
+
store_02.put({title_02:'Quarry Memories_02', author_02:'Fred_02', isbn_01:123456_02});
|
144
|
+
|
145
|
+
};
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
request.onsuccess = function(){
|
150
|
+
|
151
|
+
db = request.result;
|
152
|
+
|
153
|
+
transaction_01 = db.transaction('book_01', 'readwrite');
|
154
|
+
|
155
|
+
store_01 = transaction_01.objectStore('book_01');
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
transaction_02 = db.transaction('book_01', 'readwrite');
|
160
|
+
|
161
|
+
store_02 = transaction_02.objectStore('book_01');
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
store_01.put({title_01:'Quarry Memories_01', author_01:'Fred_01', isbn_01:234567_01});
|
166
|
+
|
167
|
+
store_02.put({title_02:'Quarry Memories_02', author_02:'Fred_02', isbn_01:234567_02});
|
168
|
+
|
169
|
+
};
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
indexDataBase();
|
176
|
+
|
177
|
+
```
|