2 Replies Latest reply on Aug 29, 2013 6:56 AM by bmajsak

    sql import script executes incorrectly between '/' characters

    akshayv

      Hi,

      I'm using Arquillian with JBOSS AS7, and I am performing datasbase tests.

      Before the test class, I have added the annotation: @ApplyScriptBefore to run my custom SQL script

       

      I am using a local MySQL instance as a database, and have included the relevant driver.

       

      Everything works fine until I try to insert values into one of the tables from the sql script.

      If i try to insert a URLs, eg:

      insert into DocumentURL (id,documentUrl) values (1,'http://www.mysql.com/yyy');

      insert into DocumentURL (id,documentUrl) values (2,'http://www.mysql.com/zzz');

      insert into DocumentURL (id,documentUrl) values (3,'http://www.mysql.com/aaa');

      insert into DocumentURL (id,documentUrl) values (4,'http://www.mysql.com/bbb');

       

      all data between two consecutive '/' signs is lost.

      So if I check in the database, I get:

      select * from DocumentURL;

      +----+---------------------------+

      | id | documentUrl               |

      +----+---------------------------+

      |  1 | http:www.mysql.comzzz |

      |  3 | http:www.mysql.combbb |

      +----+---------------------------+

       

      Is this a problem with my arquillian.xml configuration?

      <?xml version="1.0" encoding="UTF-8"?>

      <arquillian xmlns="http://jboss.org/schema/arquillian"

                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                  xsi:schemaLocation="http://jboss.org/schema/arquillian

          http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

       

       

          <container qualifier="jboss" default="true">

       

       

              <configuration>

                  <property name="jbossHome">/path/to/jboss</property>

              </configuration>

          </container>

          <extension qualifier="persistence">

              <property name="scriptsToExecuteBeforeTest">SET FOREIGN_KEY_CHECKS=0;</property>

              <property name="scriptsToExecuteAfterTest">SET FOREIGN_KEY_CHECKS=1;</property>

              <property name="sqlStatementDelimiter">;</property>

          </extension>

       

       

      </arquillian>

       

       

      I'm using arquillian-persistence-api version 1.0.0.Alpha6

       

      Thanks

        • 1. Re: sql import script executes incorrectly between '/' characters
          gerry.matte

          I've always had trouble trying to store URL strings into a mysql database ..... Retrieval by a search query is also problematic.

          Try using URLEncoder to convert a URL string to a more useable format before inserting it into mysql.

          You'll also need URLDecoder most likely.

           

          I've avoided the problem for data columns if I can strip off the http:// characters but increasingly URLs are using https:// and reconstructing the full URL is then a problem.

          • 2. Re: sql import script executes incorrectly between '/' characters
            bmajsak

            Hi Akshay,

             

            the problem might be that // is in some engines treated as comment and APE is stripping comments before executing any SQL script. If you can execute this script against your DB directly then it's obviously a bug on my side. Would be so kind and file Jira ticket if that is the case?

             

            Cheers,

            Bartosz