sqlite-dynamic.js
function( collectionID, key ) {
            collectionID = collectionID.toLowerCase();

            var deferred = q.defer();
            schemaSyncer.prepCollection(collectionID)
            .then( function() {
                sqliteObj.find( collectionID, {'_id': key}, false, 1 ).then(
                    // success
                    function(r) {
                        if ( r && r.length > 0 ) {
                            var firstElement = r[0];
                            if ( isValue(firstElement[key]) ) {
                                var value = firstElement[key];
                                deferred.resolve(value);
                            } else {
                                deferred.resolve(firstElement);
                            }
                        }
                        return deferred.resolve(null);
                    },

                    // failure
                    function(e) {
                        return q.reject(e);
                    }
                );
            });

            return deferred.promise;
        }
function( collectionID, key ) {
            collectionID = collectionID.toLowerCase();

            var deferred = q.defer();
            schemaSyncer.prepCollection(collectionID)
            .then( function() {
                sqliteObj.find( collectionID, {'_id': key}, false, 1 ).then(
                    // success
                    function(r) {
                        if ( r && r.length > 0 ) {
                            var firstElement = r[0];
                            if ( isValue(firstElement[key]) ) {
                                var value = firstElement[key];
                                deferred.resolve(value);
                            } else {
                                deferred.resolve(firstElement);
                            }
                        }
                        return deferred.resolve(null);
                    },

                    // failure
                    function(e) {
                        return q.reject(e);
                    }
                );
            });

            return deferred.promise;
        }
function ( collectionID , key ) { collectionID = collectionID . toLowerCase ( ) ; var deferred = q . defer ( ) ; schemaSyncer . prepCollection ( collectionID ) . then ( function ( ) { sqliteObj . find ( collectionID , { '_id' : key } , false , 1 ) . then ( // success function ( r ) { if ( r && r . length > 0 ) { var firstElement = r [ 0 ] ; if ( isValue ( firstElement [ key ] ) ) { var value = firstElement [ key ] ; deferred . resolve ( value ) ; } else { deferred . resolve ( firstElement ) ; } } return deferred . resolve ( null ) ; } , // failure function ( e ) { return q . reject ( e ) ; } ) ; } ) ; return deferred . promise ; }
Retrieve a piece of data from a named collection whose key is the one provided.
@param collectionID
@param key
Retrieve a piece of data from a named collection whose key is the one provided .