Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-3497

getCountRowsSql() has wrong SQL syntax

    XMLWordPrintable

Details

    Description

      When I run tests with mysql database following exception is thrown
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) FROM `mix_str____defaultcache`' at line 1
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
      at com.mysql.jdbc.Util.getInstance(Util.java:386)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
      at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322)
      at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
      at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedStore.size(JdbcStringBasedStore.java:358)

      TableManipulation.java
         public String getCountRowsSql() {
            if (countRowsSql == null) {
               countRowsSql = "SELECT COUNT (*) FROM " + getTableName(); <<< here should be COUNT(*) without space
            }
            return countRowsSql;
         }
      

      MySQL is complaining when there is SPACE between COUNT and
      >[Error] Script lines: 5-6 --------------------------
      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) FROM `edg_string____defaultcache`' at line 1 �

      Attachments

        Activity

          People

            mircea.markus Mircea Markus (Inactive)
            vchepeli_jira Vitalii Chepeliuk (Inactive)
            Vitalii Chepeliuk Vitalii Chepeliuk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: