Hello,
I'm using GWT 2.5.1 and SmartGWT Power Edition 3.1p-2013-08-05. In production I'm using SQL Server 2008 R2 with Microsoft JDBC Driver v4.
When I add a criteria on an integer the SQL surprisingly generates LIKE '%0%' queries.
This can be reproduced on the BuiltinDS application with HSQL too.
Here are the steps to reproduce the problem:
1. Create a new DataSource class:
Register this class on the animal datasource:
When you choose the animals DS in the top grid the generated query is ok:
If you use put something in the bound form and use fetch, delete what you put in the bound form and use the filter functionality, the generated query is wrong:
There shouldn't have a LIKE operator on an integer field. The problem here is that if I you change the life span of an animal to 150 it will appear in the list (at least on SQL Server 2008).
In the datasource class I've tried to put:
But with this it doesn't filter anymore the list.
I can't simply use:
Because all fetch will be filtered, including the one for the grids where I want the substring behaviour.
I'm using GWT 2.5.1 and SmartGWT Power Edition 3.1p-2013-08-05. In production I'm using SQL Server 2008 R2 with Microsoft JDBC Driver v4.
When I add a criteria on an integer the SQL surprisingly generates LIKE '%0%' queries.
This can be reproduced on the BuiltinDS application with HSQL too.
Here are the steps to reproduce the problem:
1. Create a new DataSource class:
Code:
package com.smartgwt.sample.server.listener; import com.isomorphic.datasource.DSRequest; import com.isomorphic.datasource.DSResponse; import com.isomorphic.sql.SQLDataSource; public class BuiltinDsDatasource extends SQLDataSource { /** * */ private static final long serialVersionUID = 1L; @Override public DSResponse executeFetch(DSRequest req) throws Exception { req.addToCriteria("lifeSpan", 50); return super.executeFetch(req); } }
Code:
<DataSource ID="animals" serverType="sql" tableName="animals" testFileName="animals.data.xml" serverConstructor="com.smartgwt.sample.server.listener.BuiltinDsDatasource" >
Code:
SELECT LIMIT 0 75 animals.commonName, animals.diet, animals.information, animals.lifeSpan, animals.picture, animals.scientificName, animals.status FROM animals WHERE (animals.lifeSpan=50)
Code:
SELECT LIMIT 0 75 animals.commonName, animals.diet, animals.information, animals.lifeSpan, animals.picture, animals.scientificName, animals.status FROM animals WHERE (LOWER(animals.lifeSpan) LIKE '%50%' ESCAPE '\')
In the datasource class I've tried to put:
Code:
req.addToCriteria("lifeSpan", OperatorId.EQUALS.toString(), 50);
I can't simply use:
Code:
req.setTextMatchStyle(TextMatchStyle.EXACT.getValue());
Comment