Small Tool for converting SQL statements into stringBuffer using javascript, sqlstringbuffer
SQL is a small tool for converting SQL into stringBuffer. It is very troublesome to splice SQL at the dao layer. This tool can be used to quickly splice compiled SQL statements in the SQL tool, and then copy them in.
Demo address: http://runjs.cn/detail/fj14tpyu is a bit ugly, it is recommended to view the full screen, but you can download it to modify it yourself
Code
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> change SQL </TITLE> <META NAME = "Generator "CONTENT =" EditPlus "> <meta name =" Author "CONTENT =" "> <meta name =" Keywords "CONTENT =" "> <meta name =" Description "CONTENT = ""> <script> var ie =! -[1,]; function changeSQL () {var srcSQL = document. getElementById ("srcSQL"); var srcInner = srcSQL. value; var sqlBuf = "sqlBuf" var BufObj = "StringBuffer sqlBuf = new StringBuffer ();" var newSrc = ""; if (ie) {var newSrc = srcInner. split ("\ r \ n");} else {var patt = new RegExp (/. +/g); var newSrc = srcInner. match (patt);} var len = newSrc. length; for (var I = 0; I <len; I ++) {var temp = newSrc [I]; if (I <len-1) {sqlBuf + = ". append (\ "" + temp + "\") "+" \ r \ n ";} if (I = len-1) {sqlBuf + = ". append (\ "" + temp + "\"); ";}} var showSQL = document. getElementById ("showSQL"); showSQL. innerText = BufObj + "\ n" + sqlBuf ;} </script> </HEAD> <BODY> <table border = "1" width = "100%"> <tr align = "center"> <td width = "45%"> <textarea id = "srcSQL" rows = "40" cols = "85"> </textarea> </td> <button onclick = "changeSQL () "style =" cursor: hand; "> <font color =" blue "size =" 5 "> <B> conversion </B> </button> <p> </td> <td width =" 45% "> <textarea id =" showSQL "rows =" 40 "cols =" 85 "> </textarea> </td> </tr> </table> </BODY> </HTML>
The above is all the content of this article. I hope you will like it.