storage.js
function readJointWithBall(conn, unit, handleJoint) {
	readJoint(conn, unit, {
		ifNotFound: function(){
			throw Error("joint not found, unit "+unit);
		},
		ifFound: function(objJoint){
			if (objJoint.ball)
				return handleJoint(objJoint);
			conn.query("SELECT ball FROM balls WHERE unit=?", [unit], function(rows){
				if (rows.length === 1)
					objJoint.ball = rows[0].ball;
				handleJoint(objJoint);
			});
		}
	});
}
function readJointWithBall(conn, unit, handleJoint) {
	readJoint(conn, unit, {
		ifNotFound: function(){
			throw Error("joint not found, unit "+unit);
		},
		ifFound: function(objJoint){
			if (objJoint.ball)
				return handleJoint(objJoint);
			conn.query("SELECT ball FROM balls WHERE unit=?", [unit], function(rows){
				if (rows.length === 1)
					objJoint.ball = rows[0].ball;
				handleJoint(objJoint);
			});
		}
	});
}
function readJointWithBall ( conn , unit , handleJoint ) { readJoint ( conn , unit , { ifNotFound : function ( ) { throw Error ( "joint not found, unit " + unit ) ; } , ifFound : function ( objJoint ) { if ( objJoint . ball ) return handleJoint ( objJoint ) ; conn . query ( "SELECT ball FROM balls WHERE unit=?" , [ unit ] , function ( rows ) { if ( rows . length === 1 ) objJoint . ball = rows [ 0 ] . ball ; handleJoint ( objJoint ) ; } ) ; } } ) ; }
add .ball even if it is not retrievable
add . ball even if it is not retrievable