if(!dojox.sql.db){ dojox.sql.db = google.gears.factory.create("beta.database", "1.0"); } 
dojox.sql._initDb(); 
dojox.sql = function(){	// There are four ways to call this:	// 1) Straight SQL: dojox.sql("SELECT * FROM FOOBAR");	// 2) SQL with parameters: dojox.sql("INSERT INTO FOOBAR VALUES (?)", someParam)	// 3) Encrypting particular values: 	//		dojox.sql("INSERT INTO FOOBAR VALUES (ENCRYPT(?))", someParam, "somePassword", callbackFunction)	// 4) Decrypting particular values:	//		dojox.sql("SELECT DECRYPT(SOMECOL1), DECRYPT(SOMECOL2) FROM	//				FOOBAR WHERE SOMECOL3 = ?", someParam,	//				"somePassword", callbackFunction)	//	// For encryption and decryption the last two values should be the the password for	// encryption/decryption, and the callback function that gets the result set.	//	// Note: We only support ENCRYPT(?) statements, and	// and DECRYPT(*) statements for now -- you can not have a literal string	// inside of these, such as ENCRYPT('foobar')	//	// Note: If you have multiple columns to encrypt and decrypt, you can use the following	// convenience form to not have to type ENCRYPT(?)/DECRYPT(*) many times:	//	// dojox.sql("INSERT INTO FOOBAR VALUES (ENCRYPT(?, ?, ?))", 	//				someParam1, someParam2, someParam3, 	//				"somePassword", callbackFunction)	//	// dojox.sql("SELECT DECRYPT(SOMECOL1, SOMECOL2) FROM	//				FOOBAR WHERE SOMECOL3 = ?", someParam,	//				"somePassword", callbackFunction)		// determine our parameters	var sql = null;	var callbackFunction = null;	var password = null;	var args = dojo._toArray(arguments);	sql = args.splice(0, 1)[0];	// does this SQL statement use the ENCRYPT or DECRYPT	// keywords? if so, extract our callbackFunction and crypto	// password	if(dojox.sql._needsEncrypt(sql) || dojox.sql._needsDecrypt(sql)){		callbackFunction = args.splice(args.length - 1, 1)[0];		password = args.splice(args.length - 1, 1)[0];	}	// 'args' now just has the SQL parameters	// get the Gears Database object	if(!dojox.sql.db){		dojox.sql.db = google.gears.factory.create("beta.database", "1.0");	}	// print out debug SQL output if the developer wants that	if(dojox.sql.debug == true){		dojox.sql._printDebugSQL(sql, args);	}	// handle SQL that needs encryption/decryption differently	// do we have an ENCRYPT SQL statement? if so, handle that first	if(dojox.sql._needsEncrypt(sql)){		dojox.sql._execEncryptSQL(sql, password, args, callbackFunction);		return; // encrypted results will arrive asynchronously	}else if(dojox.sql._needsDecrypt(sql)){ // otherwise we have a DECRYPT statement		dojox.sql._execDecryptSQL(sql, password, args, callbackFunction);		return; // decrypted results will arrive asynchronously	}	// console.debug(sql);	// execute the SQL and get the results	var rs = dojox.sql.db.execute(sql, args);	// Gears ResultSet object's are ugly -- normalize	// these into something JavaScript programmers know	// how to work with, basically an array of 	// JavaScript objects where each property name is	// simply the field name for a column of data	return dojox.sql._normalizeResults(rs);}
5168	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5168/f90361786e3cd064192a7a10280e5b8a8949e6cd/common.js/buggy/_sql/common.js