Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
jio
Commits
9853d53e
Commit
9853d53e
authored
Jun 10, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix big data storage problem
parent
f976d3de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
50 deletions
+44
-50
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+44
-50
No files found.
src/jio.storage/indexeddbstorage.js
View file @
9853d53e
...
...
@@ -595,22 +595,15 @@
transaction
,
global_db
,
BlobInfo
,
digest
,
readResult
;
new
RSVP
.
Queue
()
.
push
(
jIO
.
util
.
readBlobAsText
(
metadata
.
_blob
).
then
(
function
(
e
)
{
digest
=
jIO
.
util
.
makeBinaryStringDigest
(
e
.
target
.
result
);
//xxx
readResult
=
e
.
target
.
result
;
jIO
.
util
.
readBlobAsArrayBuffer
(
metadata
.
_blob
)
.
then
(
function
(
event
)
{
readResult
=
event
.
target
.
result
;
BlobInfo
=
{
"
content_type
"
:
metadata
.
_blob
.
type
,
"
digest
"
:
digest
,
"
length
"
:
metadata
.
_blob
.
size
};
},
function
()
{
command
.
error
(
"
conflict
"
,
"
broken blob
"
,
"
Cannot read data to put
"
);
}))
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
openIndexedDB
(
jio_storage
.
_database_name
);
})
...
...
@@ -618,7 +611,8 @@
global_db
=
db
;
transaction
=
db
.
transaction
([
"
attachment
"
,
"
blob
"
],
"
readwrite
"
);
return
promiseResearch
(
transaction
,
metadata
.
_id
,
"
attachment
"
,
"
_id
"
);
return
promiseResearch
(
transaction
,
metadata
.
_id
,
"
attachment
"
,
"
_id
"
);
})
.
push
(
function
(
researchResult
)
{
if
(
researchResult
.
result
===
undefined
)
{
...
...
@@ -626,8 +620,8 @@
"
message
"
:
"
indexeddbStorage unable to put attachment
"
});
}
//update attachment
researchResult
.
result
.
_attachment
=
researchResult
.
result
.
_attachment
||
{};
researchResult
.
result
.
_attachment
=
researchResult
.
result
.
_attachment
||
{};
researchResult
.
result
.
_attachment
[
metadata
.
_attachment
]
=
(
BlobInfo
===
undefined
)
?
"
BlobInfo
"
:
BlobInfo
;
return
putIndexedDB
(
researchResult
.
store
,
researchResult
.
result
);
...
...
@@ -638,9 +632,8 @@
return
putIndexedDB
(
store
,
{
"
_id
"
:
metadata
.
_id
,
"
_attachment
"
:
metadata
.
_attachment
,
"
blob
"
:
metadata
.
_blob
},
readResult
);
})
.
push
(
function
()
{
return
({
"
digest
"
:
digest
});
//xxx
}).
push
(
function
()
{
return
{
"
status
"
:
204
};
})
.
push
(
undefined
,
function
(
error
)
{
// Check if transaction is ongoing, if so, abort it
...
...
@@ -653,6 +646,7 @@
throw
error
;
})
.
push
(
command
.
success
,
command
.
error
,
command
.
notify
);
});
};
...
...
@@ -688,7 +682,7 @@
})
.
push
(
function
(
result
)
{
//get data
if
(
typeof
result
.
blob
===
"
string
"
)
{
if
(
result
.
blob
.
byteLength
!==
undefined
)
{
result
.
blob
=
new
Blob
([
result
.
blob
],
{
type
:
"
text/plain
"
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment