Thread: [OJB-developers] Bug in OQLQueryImpl
Brought to you by:
thma
From: Matthew B. <ma...@so...> - 2002-05-01 05:35:59
|
During the criteria flattening, to create the bind iterator, all criteria, regardless of if they have actual bindable criteria or not, are added to the bind iterator. I spent some time trying to find a rather nasty bug where my criteria wasn't getting bound correctly and came up with this: private Vector flatten(Criteria crit, Vector acc) { Enumeration e = crit.getElements(); while (e.hasMoreElements()) { Object o = e.nextElement(); if (o instanceof Criteria) { Criteria pc = (Criteria) o; flatten(pc, acc); } else { // null criteria doesn't have a binding variable. if (!(o instanceof ojb.broker.query.NullCriteria)) { SelectionCriteria c = (SelectionCriteria) o; acc.add(c); } } } return acc; } null doesn't have a binding variable, so we skip it. Are there other criteria types that don't have a bind variable ($X). Thomas, could you commit this fix? I'm still getting my CVS access set up (and figuring out cvs :)) |
From: Jakob B. <jbr...@ho...> - 2002-05-01 07:07:07
|
hi matthew, EqualToColumnCriteria and SqlCriteria do not have bind variables, BetweenCriteria has two of them. jakob ----- Original Message ----- From: "Matthew Baird" <ma...@so...> To: <obj...@li...> Sent: Wednesday, May 01, 2002 7:36 AM Subject: [OJB-developers] Bug in OQLQueryImpl > > During the criteria flattening, to create the bind iterator, all criteria, > regardless of if they have actual bindable criteria or not, are added to the > bind iterator. I spent some time trying to find a rather nasty bug where my > criteria wasn't getting bound correctly and came up with this: > > > private Vector flatten(Criteria crit, Vector acc) > { > Enumeration e = crit.getElements(); > while (e.hasMoreElements()) > { > Object o = e.nextElement(); > if (o instanceof Criteria) > { > Criteria pc = (Criteria) o; > flatten(pc, acc); > } > else > { > // null criteria doesn't have a binding variable. > if (!(o instanceof ojb.broker.query.NullCriteria)) > { > SelectionCriteria c = (SelectionCriteria) o; > acc.add(c); > } > } > } > return acc; > } > > null doesn't have a binding variable, so we skip it. Are there other > criteria types that don't have a bind variable ($X). > > Thomas, could you commit this fix? I'm still getting my CVS access set up > (and figuring out cvs :)) > > |
From: Thomas M. <tho...@ho...> - 2002-05-02 04:58:40
|
fixed it ! There have been similar bugs with the BetweenCriteria, which takes two parameters. Jakob did you found a fix for this in the meantime ? Thanks, Thomas Matthew Baird wrote: > During the criteria flattening, to create the bind iterator, all criteria, > regardless of if they have actual bindable criteria or not, are added to the > bind iterator. I spent some time trying to find a rather nasty bug where my > criteria wasn't getting bound correctly and came up with this: > > > private Vector flatten(Criteria crit, Vector acc) > { > Enumeration e = crit.getElements(); > while (e.hasMoreElements()) > { > Object o = e.nextElement(); > if (o instanceof Criteria) > { > Criteria pc = (Criteria) o; > flatten(pc, acc); > } > else > { > // null criteria doesn't have a binding variable. > if (!(o instanceof ojb.broker.query.NullCriteria)) > { > SelectionCriteria c = (SelectionCriteria) o; > acc.add(c); > } > } > } > return acc; > } > > null doesn't have a binding variable, so we skip it. Are there other > criteria types that don't have a bind variable ($X). > > Thomas, could you commit this fix? I'm still getting my CVS access set up > (and figuring out cvs :)) > > > > > |
From: Jakob B. <jbr...@ho...> - 2002-05-02 05:42:48
|
hi thomas, i fixed this bug long time ago, but it may still be on the todo-list public void bind(Object parameter) throws org.odmg.QueryParameterCountInvalidException, org.odmg.QueryParameterTypeInvalidException { ... // BRJ: bind is called twice for between if (crit instanceof BetweenCriteria && !crit.isBound()) getBindIterator().previous(); ... jakob ----- Original Message ----- From: "Thomas Mahler" <tho...@ho...> To: "Matthew Baird" <ma...@so...> Cc: <obj...@li...> Sent: Thursday, May 02, 2002 6:58 AM Subject: Re: [OJB-developers] Bug in OQLQueryImpl > fixed it ! > > There have been similar bugs with the BetweenCriteria, which takes two > parameters. > Jakob did you found a fix for this in the meantime ? > > Thanks, > > Thomas > > Matthew Baird wrote: > > > During the criteria flattening, to create the bind iterator, all > criteria, > > regardless of if they have actual bindable criteria or not, are added > to the > > bind iterator. I spent some time trying to find a rather nasty bug > where my > > criteria wasn't getting bound correctly and came up with this: > > > > > > private Vector flatten(Criteria crit, Vector acc) > > { > > Enumeration e = crit.getElements(); > > while (e.hasMoreElements()) > > { > > Object o = e.nextElement(); > > if (o instanceof Criteria) > > { > > Criteria pc = (Criteria) o; > > flatten(pc, acc); > > } > > else > > { > > // null criteria doesn't have a binding variable. > > if (!(o instanceof ojb.broker.query.NullCriteria)) > > { > > SelectionCriteria c = (SelectionCriteria) o; > > acc.add(c); > > } > > } > > } > > return acc; > > } > > > > null doesn't have a binding variable, so we skip it. Are there other > > criteria types that don't have a bind variable ($X). > > > > Thomas, could you commit this fix? I'm still getting my CVS access set up > > (and figuring out cvs :)) > > > > > > > > > > > > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |