但行好事
莫论前程❤

sql转换StringBuffer小工具

新建一个txt文件,复制下列代码,然后将文件后缀名改为.html即可使用

<!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="">
<META http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script>
  var ie = !-[1,];  
  function changeSQL(){
    var srcSQL = document.getElementById("srcSQL");
    var srcInner = srcSQL.value;
    var 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 += "sql.append(\" " + temp + " \")" + ";" + "\r\n";
      }
      if(i == len-1){
      sqlBuf += "sql.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>
    <td>
      <button onclick="changeSQL()" style="cursor:hand;"><font color="blue" size="5"><b>转换</b></button><p>

    </td>
    <td width="45%"><textarea id="showSQL" rows="40" cols="85" ></textarea></td>
  </tr>
</table>
</BODY>
</HTML>
赞(1) 打赏
未经允许不得转载:刘鹏博客 » sql转换StringBuffer小工具
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏