Page 1 of 1

Possible bug with ftMemo bind variable.

Posted: Wed 10 Feb 2016 15:00
by MarkF
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:

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;
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.

Re: Possible bug with ftMemo bind variable.

Posted: Thu 11 Feb 2016 09:34
by AlexP
Hello,

Thank you for the sample. We have reproduce the issue and will investigate the reasons for such behavior.

Re: Possible bug with ftMemo bind variable.

Posted: Fri 12 Feb 2016 10:10
by AlexP
We have already fixed the problem. The fix will be included in the next version.