2013-09-13 13:50:41 -04:00
|
|
|
// ClientBase
|
|
|
|
// ----------
|
2013-11-27 16:51:01 -05:00
|
|
|
var Helpers = require('../lib/helpers').Helpers;
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// The `ClientBase` is assumed as the object that all database `clients`
|
|
|
|
// inherit from, and is used in an `instanceof` check when initializing the
|
|
|
|
// library. If you wish to write or customize an adapter, just inherit from
|
|
|
|
// this base, with `ClientBase.extend`, and you're good to go.
|
|
|
|
var ClientBase = function() {};
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// The methods assumed when building a client.
|
|
|
|
ClientBase.prototype = {
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Gets the raw connection for the current client.
|
|
|
|
getRawConnection: function() {},
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Execute a query on the specified `Builder` or `SchemaBuilder`
|
|
|
|
// interface. If a `connection` is specified, use it, otherwise
|
|
|
|
// acquire a connection, and then dispose of it when we're done.
|
|
|
|
query: function() {},
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Retrieves a connection from the connection pool,
|
|
|
|
// returning a promise.
|
|
|
|
getConnection: function() {},
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Releases a connection from the connection pool,
|
|
|
|
// returning a promise.
|
|
|
|
releaseConnection: function(conn) {},
|
2013-09-08 15:57:32 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Begins a transaction statement on the instance,
|
|
|
|
// resolving with the connection of the current transaction.
|
|
|
|
startTransaction: function() {},
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Finishes a transaction, taking the `type`
|
|
|
|
finishTransaction: function(type, transaction, msg) {},
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// The pool defaults.
|
|
|
|
poolDefaults: function() {}
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
};
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
// Grab the standard `Object.extend` as popularized by Backbone.js.
|
|
|
|
ClientBase.extend = Helpers.extend;
|
2013-09-04 20:47:27 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
exports.ClientBase = ClientBase;
|