Beautiful database API for secure, robust, high-performance, maintainable, large-scale javascript web app.
ydn.db.Cursor
object and db.open
for more powerful readwrite
usage, cursor resumeparent
schemaydn.db.Query
will compile to ydn.db.Cursor
for IndexedDB and native SQL for WebSQLSupport all modern browsers on mobile, tablet and desktop.
Import lastest minified JS script (see download section) to your HTML files. This will create single object in the global scope, call ydn.db.Storage.
var db = new ydn.db.Storage('db name'); db.setItem('x', 'some value') db.getItem('x').success(function(value) { console.log('x = ' + value); }
Calculate average by using query
q = db.query('customer').average('age'); avg = q.fetch()
Key-range query
q = db.query('customer', 'age', 18, 25).where('sex', '=', 'FEMALE').select('full_name') young_girl_names = q.fetch()
Example for updating an entity with a new property value relative to its current value.
db.transaction(function(tdb) { tdb.get('player', 1).success(function(p1_obj) { p1_obj.health += 10; tdb.put('player', p123_obj); }); }, ['player'], 'readwrite');
String value data can be optionally encrypted using SHA-1 cipher.
db = new ydn.db.Store('store name') db.setSecret(passphase); // generally send from server side upon login db.setItem(key, value, 3600*1000); // data expire on one hour db.getItem(key); // data will be decrypted using the provided passphase
Licensed under the Apache License, Version 2.0
--
You received this message because you are subscribed to the Google Groups "Chromium HTML5" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-html5/-/l4P3WQ6GLQAJ.
To post to this group, send email to chromiu...@chromium.org.
To unsubscribe from this group, send email to chromium-html...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-html5/?hl=en.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-html5/-/xLfMTzVi7qwJ.
On Wed, Oct 10, 2012 at 6:23 PM, Kyaw <kya...@yathit.com> wrote:
> Great idea! I also think web worker is the way to go for query.
I'm curious why you think a worker is the way to go? Have you had
performance problems on the main thread?
I suspect that, at least currently, most performance issues, even with the
queries, are going to be I/O related, not CPU related, which means running
off the main thread won't buy you much... plus in chrome's implementation,
much of the heavy leveldb work is going to happen in a separate background
thread anyway...
..and if anything you're now paying the overhead of shuttling data between
the main thread and the worker through postMessage, which at least in
Chrome isn't very fast... but I'm willing to be proven wrong!
I was working on a LINQ (Microsoft's DB query language) library for playing with data, and wanted querying capabilities that go beyond indexes - typically something like
\[http://linq2indexeddb.codeplex.com/SourceControl/changeset/view/69753#1167101]
- Queries involving 2 fields in the data
- Queries across objectStores.
I remember that there were discussions in W3C IndexedDB lists about supporting multiple indexes (indexes on indexes), but that never happened.
Executing these queries is typically getting the data back and then using the workers to iterate over data and get the final result.
The hope was, if workers supported Sync calls, IndexedDB data can be retrieved and processes in the worker itself - till then we need to pass the input to the worker and get the output back.
--
You received this message because you are subscribed to the Google Groups "Chromium HTML5" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-html5/-/1qRFxVdauTUJ.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-html5+unsubscribe@chromium.org.
To post to this group, send email to chromiu...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-html5/.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.