Rdb2.js

A new version of RdbHost's JavaScript module is out. It is for modern browsers only, expecting to find websockets and promises supported. It will feature-test and load polyfills as required.

The range of features in this version is minimalist compared to the jQuery plugin, but that is temporary and deliberate. This module is meant to be extensible, and additional modules will be released over time to broaden the functionality. A credit-charging module is done, but not yet documented. Also, LAB.js is not required, but is expected to be available, and the boilerplate uses it to load shims as necessary.

For now, only the core module is public, but I am working on the other functionality. Consider this to be alpha code. We hope to not change the API, but do not promise it.

If you are unaware of RdbHost, we are a PAAS (Platform As A Service) that uses SQL itself as the API. If you know SQL, you will learn RdbHost in a half hour.

An Example:

var prom = Rdbhost.preauth()
           .query('SELECT * FROM students \
                    WHERE name = %(name)s;')
           .params({name: 'Bobby Tables'})
           .get_data();

prom.then(function(data) {
         alert(d.record_sets[0].records[0].name);
      })
      .catch(function(err) {
          alert('ERROR '+e);
      });

All Rdbhost JavaScript code is meant to run in a browser. You could hypothetically run it under node.js, but we do not support that and have not tested it.

There is no boilerplate bundle available through the website for version 2, yet, but that will be available eventually, probably after the planned extension modules are done, so that the boilerplate can be complete.

The source is on github, and documentation is there as well:

https://github.com/rdbhost/rdb2js/

Rdbhost hosted source is available, but is unfortunately not directly browseable.

https://www.rdbhost.com/vendor/rdbhost/2.0/lib/js/rdbhost-bundle.js

This is a JavaScript bundle, including Rdbhost-specific code as well as a reconnecting-websocket library, a pubsub library and a select subset of underscore.js. It will autoload polyfills as necessary.

Method by method documentation is at the following link:

https://www.rdbhost.com/javascript_v2.html

Enjoy

#

comments powered by Disqus