src/nopg.js
function do_select(self, types, search_opts, traits) {
	return nr_fcall("nopg:do_select", function() {
		return prepare_select_query(self, types, search_opts, traits).then(function(q) {
			var result = q.compile();

			// Unnecessary since do_query() does it too
			//if(NoPg.debug) {
			//	debug.log('query = ', result.query);
			//	debug.log('params = ', result.params);
			//}

			debug.assert(result).is('object');
			debug.assert(result.query).is('string');
			debug.assert(result.params).is('array');

			var builder;
			var type = result.documentType;

			if( (result.ObjType === NoPg.Document) &&
			  is.string(type) &&
			  self._documentBuilders &&
			  self._documentBuilders.hasOwnProperty(type) &&
			  is.func(self._documentBuilders[type]) ) {
				builder = self._documentBuilders[type];
			}
			debug.assert(builder).ignore(undefined).is('function');

			return do_query(self, result.query, result.params ).then(get_results(result.ObjType, {
				'fieldMap': result.fieldMap
			})).then(function(data) {
				if(!builder) {
					return data;
				}
				debug.log('data = ', data);
				return builder(data);
			});
		});
	});
}
function do_select(self, types, search_opts, traits) {
	return nr_fcall("nopg:do_select", function() {
		return prepare_select_query(self, types, search_opts, traits).then(function(q) {
			var result = q.compile();

			// Unnecessary since do_query() does it too
			//if(NoPg.debug) {
			//	debug.log('query = ', result.query);
			//	debug.log('params = ', result.params);
			//}

			debug.assert(result).is('object');
			debug.assert(result.query).is('string');
			debug.assert(result.params).is('array');

			var builder;
			var type = result.documentType;

			if( (result.ObjType === NoPg.Document) &&
			  is.string(type) &&
			  self._documentBuilders &&
			  self._documentBuilders.hasOwnProperty(type) &&
			  is.func(self._documentBuilders[type]) ) {
				builder = self._documentBuilders[type];
			}
			debug.assert(builder).ignore(undefined).is('function');

			return do_query(self, result.query, result.params ).then(get_results(result.ObjType, {
				'fieldMap': result.fieldMap
			})).then(function(data) {
				if(!builder) {
					return data;
				}
				debug.log('data = ', data);
				return builder(data);
			});
		});
	});
}
function do_select ( self , types , search_opts , traits ) { return nr_fcall ( "nopg:do_select" , function ( ) { return prepare_select_query ( self , types , search_opts , traits ) . then ( function ( q ) { var result = q . compile ( ) ; // Unnecessary since do_query() does it too //if(NoPg.debug) { //	debug.log('query = ', result.query); //	debug.log('params = ', result.params); //} debug . assert ( result ) . is ( 'object' ) ; debug . assert ( result . query ) . is ( 'string' ) ; debug . assert ( result . params ) . is ( 'array' ) ; var builder ; var type = result . documentType ; if ( ( result . ObjType === NoPg . Document ) && is . string ( type ) && self . _documentBuilders && self . _documentBuilders . hasOwnProperty ( type ) && is . func ( self . _documentBuilders [ type ] ) ) { builder = self . _documentBuilders [ type ] ; } debug . assert ( builder ) . ignore ( undefined ) . is ( 'function' ) ; return do_query ( self , result . query , result . params ) . then ( get_results ( result . ObjType , { 'fieldMap' : result . fieldMap } ) ) . then ( function ( data ) { if ( ! builder ) { return data ; } debug . log ( 'data = ' , data ) ; return builder ( data ) ; } ) ; } ) ; } ) ; }
Generic SELECT query
@param self {object} The NoPg connection/transaction object
@param types {}
@param search_opts {}
@param traits {object}
Generic SELECT query