├── .gitignore ├── src ├── outro.js ├── intro.js ├── query.js ├── util.js └── database.js ├── README.md ├── Makefile └── demo └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject/ -------------------------------------------------------------------------------- /src/outro.js: -------------------------------------------------------------------------------- 1 | 2 | })(window); -------------------------------------------------------------------------------- /src/intro.js: -------------------------------------------------------------------------------- 1 | (function(window, undefined) { 2 | 3 | -------------------------------------------------------------------------------- /src/query.js: -------------------------------------------------------------------------------- 1 | jDal.Query = function(q) { 2 | //query class 3 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jDal - A JavaScript Database Abstraction Library 2 | ======================= 3 | This project's purpose is to abstract client-side database access across all major browsers. 4 | This current repo is a PoC for my Software Engineering II class, since the project is extremely time-boxed the "library" 5 | will be feature starved and not written in the best, most *extensible* way possible. 6 | 7 | Rewrite 8 | ------- 9 | More than likely this will be written with a better API and renamed Garage.js soon... -------------------------------------------------------------------------------- /src/util.js: -------------------------------------------------------------------------------- 1 | window.jDal = { 2 | //allows us to keep our 'this' reference 3 | _bind: function(scope, fn, remove) { 4 | return function() { 5 | var args = Array.prototype.slice.call(arguments), 6 | remove = (remove ? remove: 0); 7 | 8 | args.splice(0, remove, this); 9 | fn.apply(scope, args); 10 | }; 11 | }, 12 | _generateGuid: function() { 13 | var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''), 14 | uuid = new Array(36), rnd=0, r; 15 | for (var i = 0; i < 36; i++) { 16 | if (i==8 || i==13 || i==18 || i==23) { 17 | uuid[i] = '-'; 18 | } else if (i==14) { 19 | uuid[i] = '4'; 20 | } else { 21 | if (rnd <= 0x02) rnd = 0x2000000 + (Math.random()*0x1000000)|0; 22 | r = rnd & 0xf; 23 | rnd = rnd >> 4; 24 | uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; 25 | } 26 | } 27 | return uuid.join(''); 28 | }, 29 | //From jQuery Source 30 | _extend: function() { 31 | var options, name, src, copy, copyIsArray, clone, 32 | target = arguments[0] || {}, 33 | i = 1, 34 | length = arguments.length, 35 | deep = false; 36 | 37 | // Handle a deep copy situation 38 | if ( typeof target === "boolean" ) { 39 | deep = target; 40 | target = arguments[1] || {}; 41 | // skip the boolean and the target 42 | i = 2; 43 | } 44 | 45 | // Handle case when target is a string or something (possible in deep copy) 46 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 47 | target = {}; 48 | } 49 | 50 | // extend jQuery itself if only one argument is passed 51 | if ( length === i ) { 52 | target = this; 53 | --i; 54 | } 55 | 56 | for ( ; i < length; i++ ) { 57 | // Only deal with non-null/undefined values 58 | if ( (options = arguments[ i ]) != null ) { 59 | // Extend the base object 60 | for ( name in options ) { 61 | src = target[ name ]; 62 | copy = options[ name ]; 63 | 64 | // Prevent never-ending loop 65 | if ( target === copy ) { 66 | continue; 67 | } 68 | 69 | // Recurse if we're merging plain objects or arrays 70 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 71 | if ( copyIsArray ) { 72 | copyIsArray = false; 73 | clone = src && jQuery.isArray(src) ? src : []; 74 | 75 | } else { 76 | clone = src && jQuery.isPlainObject(src) ? src : {}; 77 | } 78 | 79 | // Never move original objects, clone them 80 | target[ name ] = jQuery.extend( deep, clone, copy ); 81 | 82 | // Don't bring in undefined values 83 | } else if ( copy !== undefined ) { 84 | target[ name ] = copy; 85 | } 86 | } 87 | } 88 | } 89 | 90 | // Return the modified object 91 | return target; 92 | } 93 | }; -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SRC_DIR = src 2 | TEST_DIR = test 3 | BUILD_DIR = build 4 | 5 | PREFIX = . 6 | DIST_DIR = ${PREFIX}/dist 7 | 8 | BASE_FILES = ${SRC_DIR}/util.js\ 9 | ${SRC_DIR}/database.js\ 10 | ${SRC_DIR}/query.js 11 | 12 | MODULES = ${SRC_DIR}/intro.js\ 13 | ${BASE_FILES}\ 14 | ${SRC_DIR}/outro.js 15 | 16 | COMBINED = ${DIST_DIR}/jdal.js 17 | MINIFILE = jdal.min.js 18 | MINIFIED = ${DIST_DIR}/${MINIFILE} 19 | 20 | COMPILER_FILE = ${BUILD_DIR}/compiler.zip 21 | COMPILER_GET = wget -q http://closure-compiler.googlecode.com/files/compiler-latest.zip -O ${COMPILER_FILE} && unzip ${COMPILER_FILE} compiler.jar -d ${BUILD_DIR} 22 | COMPILER = ${BUILD_DIR}/compiler.jar 23 | COMPILE = java -jar ${COMPILER} --js ${COMBINED} --js_output_file ${MINIFIED} 24 | 25 | RHINO_FILE = ${BUILD_DIR}/rhino.zip 26 | RHINO_GET = wget -q ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip -O ${RHINO_FILE} && unzip ${RHINO_FILE} rhino1_7R3/js.jar -d ${BUILD_DIR} && mv ${BUILD_DIR}/rhino1_7R3/js.jar ${BUILD_DIR}/rhino.jar && rm -rf ${BUILD_DIR}/rhino1_7R3/ 27 | RHINO = ${BUILD_DIR}/rhino.jar 28 | HINT = java -jar ${RHINO} ${BUILD_DIR}/jshint-rhino.js 29 | 30 | DEMO_DIR = demo/ 31 | PACK_DIR = jdal 32 | PACK_FILE = jdal.zip 33 | PACKAGE = rm -f ${DIST_DIR}/${PACK_FILE} && zip -rqb ${BUILD_DIR} ${DIST_DIR}/${PACK_FILE} ${PACK_DIR} 34 | 35 | REPLACE = src\/jquery.omnislide.js"><\/script>.+ 9 | 10 | 11 | 12 | 134 | 135 | 145 | 146 |
147 | Database: 148 | 149 | 150 | 151 |