Possible bug with ftMemo bind variable.
Posted: Wed 10 Feb 2016 15:00
It appears that if a bind variable of type ftMemo or ftWideMemo is set to an empty string, then it will stay that way forever. This seems to have started with 9.6.21 (I think) and also exists in 9.6.22. Here's the code to reproduce:
Output is:
Input: Some Text
Output: Some Text
Correct Results
Input:
Output:
Correct Results
Input: Different Text
Output:
++++++ ERROR ++++++
Let me know if you can't reproduce this. Thanks.
Code: Select all
Query := TOraQuery.Create(nil);
try
Query.Session := Session;
Session.Connect;
WriteLn('Connected');
// Setup the SQL and params.
Query.SQL.Text := 'begin :MyOutText := :MyInText; end;';
Query.ParamByName('MyInText').AsString := 'Some Text';
Query.ParamByName('MyInText').ParamType := ptInput;
Query.ParamByName('MyOutText').DataType := ftMemo; // also ftWideMemo with Unicode settings on;
Query.ParamByName('MyOutText').ParamType := ptOutput;
Query.Execute;
WriteLn('');
WriteLn(' Input: ' + Query.ParamByName('MyInText').AsString);
WriteLn('Output: ' + Query.ParamByName('MyOutText').AsString);
if Query.ParamByName('MyInText').AsString = Query.ParamByName('MyOutText').AsString then
WriteLn(' Correct Results')
else
WriteLn(' ++++++ ERROR ++++++ ');
Query.ParamByName('MyInText').AsString := '';
Query.Execute;
WriteLn('');
WriteLn(' Input: ' + Query.ParamByName('MyInText').AsString);
WriteLn('Output: ' + Query.ParamByName('MyOutText').AsString);
if Query.ParamByName('MyInText').AsString = Query.ParamByName('MyOutText').AsString then
WriteLn(' Correct Results')
else
WriteLn(' ++++++ ERROR ++++++ ');
Query.ParamByName('MyInText').AsString := 'Different Text';
Query.Execute;
WriteLn('');
WriteLn(' Input: ' + Query.ParamByName('MyInText').AsString);
WriteLn('Output: ' + Query.ParamByName('MyOutText').AsString);
if Query.ParamByName('MyInText').AsString = Query.ParamByName('MyOutText').AsString then
WriteLn(' Correct Results')
else
WriteLn(' ++++++ ERROR ++++++ ');
WriteLn('');
Write('Press Enter to exit: ');
ReadLn;
finally
Query.Free;
end;
Input: Some Text
Output: Some Text
Correct Results
Input:
Output:
Correct Results
Input: Different Text
Output:
++++++ ERROR ++++++
Let me know if you can't reproduce this. Thanks.