mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Update scrubValues method to make instants out of DateTimes - fixes update actions in javalin apps
This commit is contained in:
@ -125,6 +125,10 @@ public abstract class AbstractRDBMSAction implements QActionInterface
|
|||||||
{
|
{
|
||||||
value = ValueUtils.getValueAsLocalDate(value);
|
value = ValueUtils.getValueAsLocalDate(value);
|
||||||
}
|
}
|
||||||
|
else if(field.getType().equals(QFieldType.DATE_TIME) && value instanceof String)
|
||||||
|
{
|
||||||
|
value = ValueUtils.getValueAsInstant(value);
|
||||||
|
}
|
||||||
else if(field.getType().equals(QFieldType.DECIMAL) && value instanceof String)
|
else if(field.getType().equals(QFieldType.DECIMAL) && value instanceof String)
|
||||||
{
|
{
|
||||||
value = ValueUtils.getValueAsBigDecimal(value);
|
value = ValueUtils.getValueAsBigDecimal(value);
|
||||||
|
@ -327,6 +327,25 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** This situation - fails in a real mysql, but not in h2... anyway, because mysql
|
||||||
|
** didn't want to convert the date-time string format to a date-time.
|
||||||
|
*******************************************************************************/
|
||||||
|
@Test
|
||||||
|
void testDateTimesCanBeModifiedFromIsoStrings() throws Exception
|
||||||
|
{
|
||||||
|
UpdateInput updateInput = initUpdateRequest();
|
||||||
|
List<QRecord> records = new ArrayList<>();
|
||||||
|
records.add(new QRecord().withTableName("person")
|
||||||
|
.withValue("id", 1)
|
||||||
|
.withValue("createDate", "2022-10-03T10:29:35Z")
|
||||||
|
.withValue("firstName", "Johnny Updated"));
|
||||||
|
updateInput.setRecords(records);
|
||||||
|
new RDBMSUpdateAction().execute(updateInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
Reference in New Issue
Block a user