Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 12th, 2012  |  syntax: None  |  size: 4.52 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. javascript:if%20(typeof(%20ShowCFDebugSQL%20)%20==%20'undefined'){%20function%20ShowCFDebugSQL(){%20var%20arrTable%20=%20document.getElementsByTagName(%20'table'%20);%20var%20arrPre%20=%20null;%20var%20objCFDebugTable%20=%20null;%20var%20arrRawData%20=%20new%20Array();%20var%20objRawData%20=%20null;%20var%20objFrame%20=%20document.createElement(%20'textarea'%20);%20var%20i%20=%200;%20for%20(i%20=%200%20;%20i%20<%20arrTable.length%20;%20i++){%20if%20(%20arrTable[%20i%20].className%20&&%20(arrTable[%20i%20].className%20==%20'cfdebug')%20){%20objCFDebugTable%20=%20arrTable[%20i%20];%20break;%20}%20}%20if%20(objCFDebugTable){%20arrPre%20=%20objCFDebugTable.getElementsByTagName(%20'pre'%20);%20for%20(i%20=%200%20;%20i%20<%20arrPre.length%20;%20i++){%20if(%20arrPre[%20i%20].innerHTML.match(%20new%20RegExp(%20'SELECT|INSERT|DELETE|JOIN|WHERE',%20'i'%20)%20)%20){%20objRawData%20=%20new%20Object();%20objRawData.SQL%20=%20arrPre[%20i%20].innerHTML;%20objRawData.Params%20=%20'';%20if%20(%20(arrPre[%20i%20].nextSibling.nodeType%20==%201)%20&&%20(arrPre[%20i%20].nextSibling.tagName.toLowerCase()%20==%20'code')%20){%20if%20(arrPre[%20i%20].nextSibling.innerHTML.match(%20new%20RegExp(%20'^Query%20Param',%20'i'%20)%20)){%20objRawData.Params%20=%20arrPre[%20i%20].nextSibling.innerHTML;%20}%20}%20else%20if%20(%20(arrPre[%20i%20].nextSibling.nextSibling.nodeType%20==%201)%20&&%20(arrPre[%20i%20].nextSibling.nextSibling.tagName.toLowerCase()%20==%20'code')%20){%20if%20(arrPre[%20i%20].nextSibling.nextSibling.innerHTML.match(%20new%20RegExp(%20'^Query%20Param',%20'i'%20)%20)){%20objRawData.Params%20=%20arrPre[%20i%20].nextSibling.nextSibling.innerHTML;%20}%20}%20if%20(objRawData.Params.length%20>%200){%20objRawData.Params%20=%20ParseParams(%20objRawData.Params%20);%20arrRawData[%20arrRawData.length%20]%20=%20objRawData;%20}%20else%20{%20%20}%20}%20}%20if%20(arrRawData.length%20>%200){%20objFrame.style.backgroundColor%20=%20'#FAFAFA';%20objFrame.style.border%20=%20'4px%20solid%20#FAB60A';%20objFrame.style.color%20=%20'#000000';%20objFrame.style.fontFamily%20=%20'monospace,%20verdana';%20objFrame.style.fontSize%20=%20'12px';%20objFrame.style.height%20=%20'500px';%20objFrame.style.left%20=%20'0px';%20objFrame.style.padding%20=%20'15px%2015px%2015px%2015px';%20objFrame.style.position%20=%20'absolute';%20objFrame.style.top%20=%20'0px';%20objFrame.style.width%20=%20'90%';%20objFrame.ondblclick%20=%20function(){%20this.parentNode.removeChild(%20this%20);%20};%20objFrame.value%20+=%20'+------------------------------------------------------------------------+\n';%20objFrame.value%20+=%20'|\n';%20objFrame.value%20+=%20'+------------------------------------------------------------------------+\n\n';%20objFrame.value%20+=%20'****%20DOUBLE-CLICK%20TO%20CLOSE%20TEXT%20AREA%20****\n\n\n';%20for%20(i%20=%200%20;%20i%20<%20arrRawData.length%20;%20i++){%20objFrame.value%20+=%20ReplaceParams(%20%20arrRawData[%20i%20].SQL,%20arrRawData[%20i%20].Params%20%20).replace(%20%20new%20RegExp(%20'<',%20'gi'%20),%20'<'%20).replace(%20new%20RegExp(%20'>',%20'gi'%20),%20'>'%20);%20objFrame.value%20+=%20'\n\n\n+---%20END%20SQL%20STATEMENT%20--------------------------------------------------+\n\n\n';%20}%20document.getElementsByTagName(%20'body'%20)[%200%20].appendChild(%20%20objFrame%20%20);%20}%20}%20else%20{%20alert(%20'I%20could%20not%20find%20the%20ColdFusion%20debugging%20information.\n'%20+%20'Try%20turnning%20on%20debugging%20and%20running%20again.'%20);%20}%20}%20function%20ReplaceParams(%20strSQL,%20arrParams%20){%20var%20intCounter%20=%200;%20return(%20%20strSQL.replace(%20new%20RegExp(%20'\\?',%20'g'%20),%20function(){%20var%20strReturn%20=%20'';%20if%20(intCounter%20<%20arrParams.length){%20strReturn%20=%20arrParams[%20intCounter%20].Value;%20if%20(!arrParams[%20intCounter%20].Type.match(%20new%20RegExp(%20'INT|NUMERIC|FLOAT|DECIMAL|DOUBLE|BIT|REAL',%20'i'%20)%20)){%20strReturn%20=%20(%20'\''%20+%20%20strReturn.replace(%20%20new%20RegExp(%20'\'',%20'g'%20),%20%20'\'\''%20%20)%20+%20%20'\''%20);%20}%20intCounter++;%20}%20return(%20strReturn%20);%20}%20)%20);%20}%20function%20ParseParams(%20strData%20){%20var%20arrParams%20=%20new%20Array();%20strData.replace(%20new%20RegExp(%20%20'Parameter\\s#(\\d+)\\(([\\w_]+)\\)\\s*=\\s*([^\\r\\n]*)',%20'gi'%20%20),%20function(%20$0,%20$1,%20$2,%20$3%20){%20var%20objParam%20=%20new%20Object();%20objParam.ID%20=%20$1;%20objParam.Type%20=%20$2;%20objParam.Value%20=%20($3).replace(%20new%20RegExp(%20'<br\\s*/?>$',%20'gi'%20),%20''%20);%20arrParams[%20arrParams.length%20]%20=%20objParam;%20}%20);%20return(%20arrParams%20);%20}%20};%20ShowCFDebugSQL();