Hello all,
    It seems that the LIMIT clause is only supported for PostgreSql and not for MySql .
 
    The following code change in org.exolab.castor.jdo.drivers.MySQLQueryExpression
is needed to support this for MySql.
 
CHANGE :
----------------------------------------------------------
public String getStatement( boolean lock )
    {
        // Do not use FOR UPDATE to lock query.
        return getStandardStatement( lock, false ).toString();
    }
 
 
TO:
---------------------------------------------------------
 public String getStatement( boolean lock )
    {
        StringBuffer sql;
 
        sql = getStandardStatement( lock, false );
  
        if ( _limit != null )
          sql.append(JDBCSyntax.Limit).append(_limit);
 
        return sql.toString();
    }
 
 
Excuse me if this is not the proper way to suggest changes....I am new to CVS and the ant build tool.
 
This code is really a modified version of the Postgres code changes by Alex...so you should thank him.
 
With this code change, the LIMIT clause will still only work with a queryParam ( ie. " Select c from
Company c LIMIT $1 " OR " Select c from Company c LIMIT $1,$2" ). 
 
Why is that?
 
Thanks,
 
Bruno
 
 
 
 
 
 
 
 
 
 

Reply via email to