mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Added 'scrubbing' of values being used in query filters. removed unused param from scrubValue method
This commit is contained in:
@ -149,7 +149,7 @@ public abstract class AbstractRDBMSAction implements QActionInterface
|
||||
** and type conversions that we can do "better" than jdbc...
|
||||
**
|
||||
*******************************************************************************/
|
||||
protected Serializable scrubValue(QFieldMetaData field, Serializable value, boolean isInsert)
|
||||
protected Serializable scrubValue(QFieldMetaData field, Serializable value)
|
||||
{
|
||||
if("".equals(value))
|
||||
{
|
||||
@ -724,9 +724,10 @@ public abstract class AbstractRDBMSAction implements QActionInterface
|
||||
throw new IllegalArgumentException("Incorrect number of values given for criteria [" + field.getName() + "]");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// replace any expression-type values with their evaluation //
|
||||
//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// replace any expression-type values with their evaluation //
|
||||
// also, "scrub" non-expression values, which type-converts them (e.g., strings in various supported date formats become LocalDate) //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
ListIterator<Serializable> valueListIterator = values.listIterator();
|
||||
while(valueListIterator.hasNext())
|
||||
{
|
||||
@ -735,6 +736,11 @@ public abstract class AbstractRDBMSAction implements QActionInterface
|
||||
{
|
||||
valueListIterator.set(expression.evaluate());
|
||||
}
|
||||
else
|
||||
{
|
||||
Serializable scrubbedValue = scrubValue(field, value);
|
||||
valueListIterator.set(scrubbedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class RDBMSInsertAction extends AbstractRDBMSAction implements InsertInte
|
||||
for(QFieldMetaData field : insertableFields)
|
||||
{
|
||||
Serializable value = record.getValue(field.getName());
|
||||
value = scrubValue(field, value, true);
|
||||
value = scrubValue(field, value);
|
||||
params.add(value);
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class RDBMSUpdateAction extends AbstractRDBMSAction implements UpdateInte
|
||||
for(String fieldName : fieldsBeingUpdated)
|
||||
{
|
||||
Serializable value = record.getValue(fieldName);
|
||||
value = scrubValue(table.getField(fieldName), value, false);
|
||||
value = scrubValue(table.getField(fieldName), value);
|
||||
rowValues.add(value);
|
||||
}
|
||||
rowValues.add(record.getValue(table.getPrimaryKeyField()));
|
||||
@ -286,7 +286,7 @@ public class RDBMSUpdateAction extends AbstractRDBMSAction implements UpdateInte
|
||||
for(String fieldName : fieldsBeingUpdated)
|
||||
{
|
||||
Serializable value = record0.getValue(fieldName);
|
||||
value = scrubValue(table.getField(fieldName), value, false);
|
||||
value = scrubValue(table.getField(fieldName), value);
|
||||
params.add(value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user