index.js
function(target) {
	target.adapter = exports;
	target.query = execQuery.bind(target);

	// Tedious cannot execute more than one query at a time, so we have to
	// implement a queue for queries, just in case someone tries to set
	// multiple queries in a row (like node-any-db-adapter-spec tests do).
	target._queue = [];
	target._waitingForQueryToFinish = false;
	var _execNextInQueue = function(){
		if (target._waitingForQueryToFinish) {
			return;
		}

		var query = target._queue.shift();

		if (query) {
			target._waitingForQueryToFinish = true;
			target.emit('query', query);

			query.once('close', function(){
				target._waitingForQueryToFinish = false;
				target.execNextInQueue();
			});

			target.execSql(query._request);
		}
	};
	target.execNextInQueue = function(query){
		if (query) {
			target._queue.push(query);
		}

		if (target._isConnected) {
			process.nextTick(_execNextInQueue);
		}
	};

	return target;
}
function(target) {
	target.adapter = exports;
	target.query = execQuery.bind(target);

	// Tedious cannot execute more than one query at a time, so we have to
	// implement a queue for queries, just in case someone tries to set
	// multiple queries in a row (like node-any-db-adapter-spec tests do).
	target._queue = [];
	target._waitingForQueryToFinish = false;
	var _execNextInQueue = function(){
		if (target._waitingForQueryToFinish) {
			return;
		}

		var query = target._queue.shift();

		if (query) {
			target._waitingForQueryToFinish = true;
			target.emit('query', query);

			query.once('close', function(){
				target._waitingForQueryToFinish = false;
				target.execNextInQueue();
			});

			target.execSql(query._request);
		}
	};
	target.execNextInQueue = function(query){
		if (query) {
			target._queue.push(query);
		}

		if (target._isConnected) {
			process.nextTick(_execNextInQueue);
		}
	};

	return target;
}
function ( target ) { target . adapter = exports ; target . query = execQuery . bind ( target ) ; // Tedious cannot execute more than one query at a time, so we have to // implement a queue for queries, just in case someone tries to set // multiple queries in a row (like node-any-db-adapter-spec tests do). target . _queue = [ ] ; target . _waitingForQueryToFinish = false ; var _execNextInQueue = function ( ) { if ( target . _waitingForQueryToFinish ) { return ; } var query = target . _queue . shift ( ) ; if ( query ) { target . _waitingForQueryToFinish = true ; target . emit ( 'query' , query ) ; query . once ( 'close' , function ( ) { target . _waitingForQueryToFinish = false ; target . execNextInQueue ( ) ; } ) ; target . execSql ( query . _request ) ; } } ; target . execNextInQueue = function ( query ) { if ( query ) { target . _queue . push ( query ) ; } if ( target . _isConnected ) { process . nextTick ( _execNextInQueue ) ; } } ; return target ; }
Inject Queryable API into object.

@private
@param {Object} target
@return {any-db~Queryable} target object with Queryable API injected
Inject Queryable API into object .