Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of {asQuery, retrieveQuery} cannot be used as receiver of .update(...) (regression in 6.2.0 -> 6.2.1) #228

Open
davidAtInleague opened this issue Jun 5, 2023 · 1 comment

Comments

@davidAtInleague
Copy link
Contributor

davidAtInleague commented Jun 5, 2023

quick v6.2.1

This seems to occur using either retrieveQuery() or asQuery().

getInstance( "X" )
  .whereValue( 1 )
  .asQuery()
  .update( { 'v' : now().add( 'ww', 1 ) } );

6.2.0 is OK
6.2.1 throws:

lucee.runtime.exp.CasterException: Can't cast Object type [DateTime] to a value of type [Struct]
  at  lucee.runtime.op.Caster.toStruct(Caster.java:2737)
  at  lucee.runtime.op.Caster.toStruct(Caster.java:2716)
  at  modules.quick.models.quickqb_cfc$cf$d.udfCall2(/modules/quick/models/QuickQB.cfc:308)
  at  modules.quick.models.quickqb_cfc$cf$d.udfCall(/modules/quick/models/QuickQB.cfc)
  at  lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
  at  lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
  at  lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
  at  lucee.runtime.ComponentImpl._call(ComponentImpl.java:697)
  at  lucee.runtime.ComponentImpl._call(ComponentImpl.java:584)
  at  lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1950)
  at  lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:900)
  at  lucee.runtime.functions.dynamicEvaluation.Invoke.call(Invoke.java:49)
  at  models.quickbuilder_cfc$cf$c.udfCall5(/quick/models/QuickBuilder.cfc:656)
  at  models.quickbuilder_cfc$cf$c.udfCall(/quick/models/QuickBuilder.cfc)
  at  lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
  at  lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
  at  lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
  at  lucee.runtime.ComponentImpl._call(ComponentImpl.java:696)
  at  lucee.runtime.ComponentImpl.onMissingMethod(ComponentImpl.java:623)
  at  lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
  at  lucee.runtime.ComponentImpl.call(ComponentImpl.java:1931)
  at  lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at  lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
  at  views.main.login_cfm$cf$e.call(/views/main/login.cfm:7)
  at  lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1056)
  at  lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
  at  lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:929)
  at  system.web.rendererencapsulator_cfm$cf.call(/coldbox/system/web/RendererEncapsulator.cfm:54)
  at  lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1056)
  at  lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
  at  lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:940)
  at  lucee.runtime.tag.CFTag.doInclude(CFTag.java:319)
  at  lucee.runtime.tag.CFTag.cfmlStartTag(CFTag.java:245)
  at  lucee.runtime.tag.CFTag.doStartTag(CFTag.java:179)
  at  system.web.renderer_cfc$cf.udfCall1(/coldbox/system/web/Renderer.cfc:469)
  at  system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc)
  ...add'l frames elided
@elpete
Copy link
Collaborator

elpete commented May 31, 2024

You shouldn't need the asQuery or retrieveQuery calls here. Instead use the QuickBuilder#updateAll method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants