Last active
December 19, 2015 01:18
-
-
Save antho1404/5874528 to your computer and use it in GitHub Desktop.
This script permits to debug websql queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
websql_query_debug = (db) -> | |
# replace transaction method needed to have transaction object | |
db.old_transaction = db.transaction | |
db.transaction = (callback) => | |
db.old_transaction (tx) => | |
# replace sql method and include log | |
tx.old_executeSql = tx.executeSql | |
tx.executeSql = (sql, values, success, error) => | |
log = sql | |
for val in values | |
log = log.replace "?", val | |
console.log log # display the executed sql with values replaced | |
tx.old_executeSql sql, values, success, error | |
callback tx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment