I'm running tests with devArt and found a bug, currently the fields of type string are not being treated when they are used in the "return" of an insert instruction for example.
Follow the complete code to simulate or problem.
ddl for database:
Code: Select all
CREATE TABLE TEST_TABLE (
ID_INT INTEGER NOT NULL,
ID_STRING VARCHAR(100) NOT NULL,
PRICE DOUBLE PRECISION
);
ALTER TABLE TEST_TABLE ADD CONSTRAINT PK_TEST_TABLE PRIMARY KEY (ID_INT, ID_STRING);
Code: Select all
procedure TForm6.FormCreate(Sender: TObject);
var
vsql : TSqldataset;
intValue: Integer;
StringValue: string;
begin
try
vsql := TSQLDataSet.Create(nil);
vsql.SQLConnection := SQLConnection1;
vsql.CommandText := 'insert into TEST_TABLE (ID_INT, '+
'ID_STRING, '+
'PRICE) '+
'values ( '+
':IN_ID_INT, '+
':IN_ID_STRING, '+
':IN_PRICE) '+
'returning ID_INT, '+
'ID_STRING ';
vsql.params.ParamByName('IN_ID_INT').asinteger := 1;
vsql.params.ParamByName('IN_ID_STRING').AsString := 'a';
vsql.params.ParamByName('IN_PRICE').AsCurrency := 1.55;
with TParam(vSQL.Params.Add) do begin
Name := 'ID_INT';
DataType := ftInteger;
ParamType := ptOutput;
end;
with TParam(vSQL.Params.Add) do begin
Name := 'ID_STRING';
DataType := ftstring;
ParamType := ptOutput;
end;
vSQL.ExecSQL;
intValue := vSQL.ParamByName('ID_INT').AsInteger;
StringValue := vSQL.ParamByName('ID_STRING').AsString;
finally
FreeAndNil(vsql);
end;
end;
Code: Select all
StringValue := vSQL.ParamByName('ID_STRING').AsString;
basically, whenever a parameter is defined of type string, its content is empty.
I believe that this type of data was not treated in the return of the instructions executed in the bank.
How can we fix this?
thanks!