Menu

#25 sql count error

open
nobody
None
5
2006-05-24
2006-05-24
No

When using a data access class to make a row count in a
list table it dosn´t work by a sql error (by example,
using
dtaAccessClass="dataaccess.DataSourceJDBCWithRowCount"
in dbforms-config.xml and <db:textFormat
contextVar="rsv_TABLE.attribute(ROWCOUNTALL)" /> )

The sql is wrong formated at
org.dbforms.event.datalist.dao.DataSourceJDBC because
an "order by" sentence is at the end of the select
count(*).

Proposed solution
-----------------

I have deleted de "orderConstraint" and compliled
dbforms and it works.

Class-> org.dbforms.event.datalist.dao.DataSourceJDBC
Method -> protected void open()

Inside --- if(isCalcRowCount()) ---

We change --- orderConstraint --- by --- new
FieldValue[]{} ---

Before
------

....

if(Util.isNull(whereClause)) {
String pquery = getTable().getSelectQuery(v,
filterConstraint, orderConstraint, sqlFilter,
Constants.COMPARE_NONE);
PreparedStatement pstmt =
connection.prepareStatement(pquery);

....

After
-------

....

if (Util.isNull(whereClause)) {
String pquery = getTable().getSelectQuery(v,
filterConstraint, new FieldValue[]{}, sqlFilter,

Constants.COMPARE_NONE);
....

Discussion


Log in to post a comment.

MongoDB Logo MongoDB