IDEMPIERE-1906 Use postgresql SIMILAR TO instead of LIKE
This commit is contained in:
parent
ffcd468f13
commit
45e1f0c654
|
@ -181,6 +181,8 @@ public class DBException extends AdempiereException
|
|||
* @param e exception
|
||||
*/
|
||||
public static boolean isInvalidIdentifierError(Exception e) {
|
||||
if (DB.isPostgreSQL())
|
||||
return isSQLState(e, "42P01");
|
||||
return isErrorCode(e, 904);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ import java.util.logging.Level;
|
|||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.Adempiere;
|
||||
|
@ -3542,7 +3543,7 @@ public class GridTable extends AbstractTableModel
|
|||
if (DBException.isInvalidIdentifierError(e0))
|
||||
log.warning("Count - " + e0.getLocalizedMessage() + "\nSQL=" + m_SQL_Count);
|
||||
else
|
||||
log.log(Level.SEVERE, "Count SQL=" + m_SQL_Count, e0);
|
||||
throw new AdempiereException(e0);
|
||||
return 0;
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -656,6 +656,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
|||
GridField mField = m_findFields[i];
|
||||
boolean isDisplayed = mField.isDisplayed();
|
||||
|
||||
if (DisplayType.isText(mField.getVO().displayType)) {
|
||||
// for string fields allow searching long strings - useful for like and similar to searches
|
||||
mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended
|
||||
mField.getVO().DisplayLength = mField.getVO().FieldLength;
|
||||
}
|
||||
if (mField.getVO().displayType == DisplayType.YesNo) {
|
||||
// Make Yes-No searchable as list
|
||||
GridFieldVO vo = mField.getVO();
|
||||
|
|
Loading…
Reference in New Issue