Logical error in pParseString and tdaSQL.ResolveCriteria
Hi,
We use:
RB Enterprise 7.02, D5 and D7, DOA against Oracle.
Just spent several hours trying to figure out why the RBuilder fails to do
an "in list" search with values containing comma ( , ), apostrophy ( ' ) or
Blank space ( ).
This is fatal because databases often contains all of these. Consider for
instance trying to do:
sales_rep in <<One of the two names "O'Brien, Mark" and "Wiik, Paul">>
Oracle would "eat" that as:
sales_rep in ('O''Brien, Mark','Wiik, Paul')
Tracked down that two parts needs change:
#1. procedure ppParseString in ppUtils.pas . I was truly puzzled that you
don't use the TStrings.commatext function, like this:
procedure ppParseString(const aString: String; aStrings: TStrings);
begin
aStrings.commatext := aString;
end;
#2 Function FormatValue in function TdaSQL.ResolveCriteria.
A bit down where it says:
else if not(IsOracle) and not(IsMSSQLServer) then
Result := '''' + Result + '''';
end
Should have been:
else if not(IsOracle) and not(IsMSSQLServer) then
Result := '''' +
StringReplace(Result,'''',''''+'''',[rfReplaceAll]) + '''';
end
You can then feed it with:
Report.AutoSearchFields[x].searchExpression := '"O'Brien, Mark","Wiik,
Paul"';
I really hope you can fix this, as I think it will improve your product.
I'll have to try to compile Report Builder tomorrow with these changes made.
Best Regards,
Paul Wiik,
Lynx Technologies
We use:
RB Enterprise 7.02, D5 and D7, DOA against Oracle.
Just spent several hours trying to figure out why the RBuilder fails to do
an "in list" search with values containing comma ( , ), apostrophy ( ' ) or
Blank space ( ).
This is fatal because databases often contains all of these. Consider for
instance trying to do:
sales_rep in <<One of the two names "O'Brien, Mark" and "Wiik, Paul">>
Oracle would "eat" that as:
sales_rep in ('O''Brien, Mark','Wiik, Paul')
Tracked down that two parts needs change:
#1. procedure ppParseString in ppUtils.pas . I was truly puzzled that you
don't use the TStrings.commatext function, like this:
procedure ppParseString(const aString: String; aStrings: TStrings);
begin
aStrings.commatext := aString;
end;
#2 Function FormatValue in function TdaSQL.ResolveCriteria.
A bit down where it says:
else if not(IsOracle) and not(IsMSSQLServer) then
Result := '''' + Result + '''';
end
Should have been:
else if not(IsOracle) and not(IsMSSQLServer) then
Result := '''' +
StringReplace(Result,'''',''''+'''',[rfReplaceAll]) + '''';
end
You can then feed it with:
Report.AutoSearchFields[x].searchExpression := '"O'Brien, Mark","Wiik,
Paul"';
I really hope you can fix this, as I think it will improve your product.
I'll have to try to compile Report Builder tomorrow with these changes made.
Best Regards,
Paul Wiik,
Lynx Technologies
This discussion has been closed.
Comments
commas and quotes.
Thanks for pointing this out. I will do some testing with the changes you
provided and get back to you as soon as possible.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Looking at it again today, I see that I was probably looking in the wrong
place where I commented:
#2 Function FormatValue in function TdaSQL.ResolveCriteria.
A bit down where it says:
else if not(IsOracle) and not(IsMSSQLServer) then
Result := '''' + Result + '''';
I see now that it says "if not(isOracle)". Where I wanted to do the changes
was indeed for Oracle.
However, it probably needs to be changed where I commented as well as
another place to handle single quotes in search text.
Best Regards,
Paul Wiik
Any news on this issue?
I still haven't got around to recompile RB to fix the problem. When I looked
at it, it seemed like a bit of work to understand what I need to recompile,
and in what order.
Best Regards,
Paul Wiik