<tfoot id='QIL8Y'></tfoot>

        <small id='QIL8Y'></small><noframes id='QIL8Y'>

        <i id='QIL8Y'><tr id='QIL8Y'><dt id='QIL8Y'><q id='QIL8Y'><span id='QIL8Y'><b id='QIL8Y'><form id='QIL8Y'><ins id='QIL8Y'></ins><ul id='QIL8Y'></ul><sub id='QIL8Y'></sub></form><legend id='QIL8Y'></legend><bdo id='QIL8Y'><pre id='QIL8Y'><center id='QIL8Y'></center></pre></bdo></b><th id='QIL8Y'></th></span></q></dt></tr></i><div id='QIL8Y'><tfoot id='QIL8Y'></tfoot><dl id='QIL8Y'><fieldset id='QIL8Y'></fieldset></dl></div>
        <legend id='QIL8Y'><style id='QIL8Y'><dir id='QIL8Y'><q id='QIL8Y'></q></dir></style></legend>
          <bdo id='QIL8Y'></bdo><ul id='QIL8Y'></ul>
      1. ant sql 插入语句在“--"字符串上失败.解决方法

        时间:2023-08-21

            <bdo id='OswiM'></bdo><ul id='OswiM'></ul>
            <tfoot id='OswiM'></tfoot>

              <i id='OswiM'><tr id='OswiM'><dt id='OswiM'><q id='OswiM'><span id='OswiM'><b id='OswiM'><form id='OswiM'><ins id='OswiM'></ins><ul id='OswiM'></ul><sub id='OswiM'></sub></form><legend id='OswiM'></legend><bdo id='OswiM'><pre id='OswiM'><center id='OswiM'></center></pre></bdo></b><th id='OswiM'></th></span></q></dt></tr></i><div id='OswiM'><tfoot id='OswiM'></tfoot><dl id='OswiM'><fieldset id='OswiM'></fieldset></dl></div>
              <legend id='OswiM'><style id='OswiM'><dir id='OswiM'><q id='OswiM'></q></dir></style></legend>

                <small id='OswiM'></small><noframes id='OswiM'>

                    <tbody id='OswiM'></tbody>
                  本文介绍了ant sql 插入语句在“--"字符串上失败.解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  背景

                  我们正在更改我们的安装脚本,以使用 ant 的sql"任务和 jdbc,而不是专有的 sql 客户端 sqlplus (oracle) 和 osql (msft).

                  We're changing our install scripts to use ant's "sql" task and jdbc rather than proprietary sql clients sqlplus (oracle) and osql (msft).

                  更新:添加了更多上下文.我们的基础数据"(种子数据)由包含供应商中立"(即在 oracle 和 mssql 中均可使用)sql 语句的 .sql 文件集合组成.

                  Updated: added more context. Our "base data" (seed data) consists of a collection of .sql files containing "vendor-neutral"(i.e. works both in oracle and mssql) sql statements.

                  问题

                  脚本运行良好,只有一个例外:

                  The scripts run fine, with one exception:

                  此 sql 在 Oracle 中失败.具体来说,某些东西(ant 或 jdbc 驱动程序)将破折号/连字符视为注释的开头"——即使它们嵌入在字符串中.请注意,同样的 sql 也适用于 ant/sql 和微软的 jdbc 驱动程序.

                  This sql fails in Oracle. Specifically, something (ant or jdbc driver) treats the dashes/hyphens as "beginning of a comment"--even though they are embedded in a string. Note that the same sql works fine with ant/sql and microsoft's jdbc driver.

                  INSERT INTO email_client (email_client_id,generated_reply_text) VALUES(100002,'----- Original Message -----');
                  

                  相关错误

                  这个ant bug 似乎可以识别问题.由于它仍然开放(8 年后),我不希望很快得到修复.但是,因为问题只出现在oracle中,所以可能出在驱动上.

                  This ant bug appears to identify the problem. As it's still open (after 8 years), I'm not hoping for a fix soon. However, because the problem appears only in oracle, it may lie with the driver.

                  oracle 驱动:jdbc 瘦驱动,版本 10.2.0.1.0

                  The oracle driver: jdbc thin driver, version 10.2.0.1.0

                  问题

                  有没有人有在 mssql 和 oracle 中都有效的解决方法?(例如,更改违规行以定义转义字符?我在插入"sql92 语法中没有看到转义")

                  Does anyone have a workaround which works in both mssql and oracle? (e.g. changing the offending lines to define an escape character? I don't see an 'escape' on the 'insert' sql92 syntax)

                  谢谢

                  推荐答案

                  在查看SQLExec"源并打开详细日志记录后,我找到了一个解决方法:

                  After viewing the 'SQLExec' source and turning on verbose logging, I found a workaround:

                  解决方法

                  如果 sql 语句包含包含--"的字符串,则将分隔符(分号)放在下一行.

                  这失败了

                  INSERT INTO email_client (email_client_id,generated_reply_text) VALUES(100002,'----- Original Message -----');
                  

                  成功

                  注意分号在单独的一行

                  INSERT INTO email_client (email_client_id,generated_reply_text) VALUES(100002,'----- Original Message -----')
                  ;
                  

                  详情

                  打开verbose logging,我看到Ant遇到违规的sql语句时,居然一次把三个sql语句传入jdbc驱动.有问题的语句、下一个语句(还包括嵌入的--")和后续语句(不包括嵌入的--").

                  Turning on verbose logging, I saw that when Ant came across the offending sql statement, it actually passed three sql statements in at once to the jdbc driver. The offending statement, the next statement (which also included an embedded '--'), and the subsequent statement (which did not include an embedded '--').

                  我快速浏览了 Ant 代码,没有发现任何明显错误.由于我不打算修补 Ant,所以我寻找了一种解决方法.

                  I gave the Ant code a quick glance and didn't see any obvious errors. Since I wasn't planning to patch Ant, I looked for a workaround.

                  调整后我发现如果我只是将分隔符(分号)移动到带有嵌入--"的语句的下一行,脚本会成功执行.

                  Tweaking with it I found that if I simply moved the delimiter (semicolon) to the next line for the statements with embedded '--', the scripts executed successfully.

                  感谢大家的参与

                  这篇关于ant sql 插入语句在“--"字符串上失败.解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 ANT SQL 任务调用时 sql 脚本执行失败 下一篇:MySql 中的 DELIMITER 错误

                  相关文章

                  最新文章

                  <i id='waYFo'><tr id='waYFo'><dt id='waYFo'><q id='waYFo'><span id='waYFo'><b id='waYFo'><form id='waYFo'><ins id='waYFo'></ins><ul id='waYFo'></ul><sub id='waYFo'></sub></form><legend id='waYFo'></legend><bdo id='waYFo'><pre id='waYFo'><center id='waYFo'></center></pre></bdo></b><th id='waYFo'></th></span></q></dt></tr></i><div id='waYFo'><tfoot id='waYFo'></tfoot><dl id='waYFo'><fieldset id='waYFo'></fieldset></dl></div>
                1. <small id='waYFo'></small><noframes id='waYFo'>

                2. <tfoot id='waYFo'></tfoot>

                    <legend id='waYFo'><style id='waYFo'><dir id='waYFo'><q id='waYFo'></q></dir></style></legend>
                      <bdo id='waYFo'></bdo><ul id='waYFo'></ul>