SMZSL00401_SQL생성기.xrw 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/css" href="../../commonweb/css/common.css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>SQL 생성기</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <main>
  10. <sql/>
  11. <param1/>
  12. <result/>
  13. </main>
  14. </root>
  15. </instance>
  16. </model>
  17. <script type="javascript" src="../../commonweb/js/common.js"/>
  18. <script type="javascript">
  19. <![CDATA[
  20. function fGenerateSQL() {
  21. var rawSql = model.getValue("/root/main/sql");
  22. var param1s = model.getValue("/root/main/param1").split(",");
  23. var param1sIndex = 0;
  24. var index = 0;
  25. rawSql = rawSql.replace(/\$|#/g, "/*param1*/");
  26. for (var i = 0, length = param1s.length; i < length; i++) {
  27. rawSql = rawSql.replace(/\/\*param1\*\//, param1s[param1sIndex++]);
  28. }
  29. /*
  30. while (true) {
  31. var hexp = new RegExp("(#|$)", "gi");
  32. var w = rawSql.match(wexp);
  33. stringIndex = rawSql.indexOf("$", index);
  34. digitIndex = rawSql.indexOf("#", index);
  35. if (stringIndex == -1 && digitIndex == -1) {
  36. break;
  37. }
  38. if (digitIndex == -1 && stringIndex != -1) {
  39. index = stringIndex;
  40. } else
  41. if (digitIndex != -1 && stringIndex == -1) {
  42. index = digitIndex;
  43. } else
  44. if (digitIndex < stringIndex) {
  45. index = stringIndex;
  46. } else
  47. if (digitIndex > stringIndex) {
  48. index = digitIndex;
  49. }
  50. rawSql = rawSql.substring(0, index) + param1s[param1sIndex++] + rawSql.substring(index +1);
  51. }
  52. */
  53. rawSql = rawSql.substring(1, rawSql.length - 2);
  54. return rawSql;
  55. }
  56. ]]>
  57. </script>
  58. </xhtml:head>
  59. <xhtml:body>
  60. <caption id="caption6" class="tit_1" style="left:0px; top:0px; width:189px; height:14px; ">SQL 생성기</caption>
  61. <line id="line32" class="line_6" style="x1:0px; y1:25px; x2:1194px; y2:25px; "/>
  62. <caption id="caption3" class="tit_2" style="left:5px; top:40px; width:149px; height:13px; ">SQL</caption>
  63. <line id="line2" class="line_1" style="x1:0px; y1:55px; x2:1190px; y2:55px; "/>
  64. <textarea id="tar_sql" ref="/root/main/sql" navindex="5" style="left:0px; top:60px; width:1190px; height:277px; "/>
  65. <input id="input1" ref="/root/main/param1" style="left:0px; top:370px; width:1190px; height:19px; "/>
  66. <caption id="caption1" class="tit_2" style="left:5px; top:350px; width:149px; height:14px; ">PARAM1</caption>
  67. <line id="line1" class="line_1" style="x1:0px; y1:365px; x2:1190px; y2:365px; "/>
  68. <textarea id="tar_result" ref="/root/main/result" navindex="5" style="left:0px; top:425px; width:1190px; height:350px; "/>
  69. <caption id="caption2" class="tit_2" style="left:0px; top:405px; width:149px; height:13px; ">RESULT</caption>
  70. <line id="line3" class="line_1" style="x1:0px; y1:420px; x2:1190px; y2:420px; "/>
  71. <button id="btn_clearsql" class="btn2_letter3" style="left:1138px; top:30px; width:53px; height:19px; ">
  72. <caption>clear</caption>
  73. <script type="javascript" ev:event="DOMActivate">
  74. <![CDATA[
  75. model.resetInstanceNode("/root/main");
  76. model.refresh();
  77. ]]>
  78. </script>
  79. </button>
  80. <button id="btn_generate" class="btn2_letter2" style="left:1100px; top:395px; width:42px; height:19px; ">
  81. <caption>생성</caption>
  82. <script type="javascript" ev:event="DOMActivate">
  83. <![CDATA[
  84. var result = fGenerateSQL();
  85. model.setValue("/root/main/result", result);
  86. model.refresh();
  87. ]]>
  88. </script>
  89. </button>
  90. <button id="btn_copy" class="btn2_letter2" style="left:1147px; top:395px; width:42px; height:19px; ">
  91. <caption>복사</caption>
  92. <script type="javascript" ev:event="DOMActivate">
  93. <![CDATA[
  94. window.clipBoardData = model.getValue("/root/main/result");
  95. ]]>
  96. </script>
  97. </button>
  98. </xhtml:body>
  99. </xhtml:html>