Why cut the value of the field
Posted: Wed 13 Nov 2013 14:12
ODAC version 6.25 or 8.6
Why cut the value of the field sSelectionName after we do refresh?
Really, after refresh, field.AsString = 'SEL_PRL_QuotientPRCKPI' instead of 'SEL_PRL_QuotientPRCKPIDet' and field.Size=Length('SEL_PRL_QuotientKPIDet')=22
function code:
In table prl_doctype for id = 172606130001 exist only one row where
sKPITabGST = Select null as id
,'SEL_PRL_QuotientPRCKPIDet' as sSelectionName
,'CLList_idQuotientKPI' as sRepresentationName
,'Показатели' as sDisplayName
,null as nImage
from dual
Why cut the value of the field sSelectionName after we do refresh?
Code: Select all
oraDataSet.Session := FOraSession;
oraDataSet.SQL.Text := 'begin open :cur for PRL_DOCTYPEAPI.getsKPITabGST(:iddoctype); end;';
oraDataSet.Params.ParamByName('cur').DataType := ftCursor;
oraDataSet.OptionsDS.AutoClose := true;
oraDataSet.Execute;
oraDataSet.Open;
if oraDataSet.RecordCount > 0 then
begin
field := oraDataSet.FieldByName('sSelectionName');
Assert(SameText(field.AsString,'SEL_PRL_QuotientKPIDet')); // !!! Correctly
end;
oraDataSet.Params.ParamByName('iddoctype').DataType := ftFloat;
oraDataSet.Params.ParamValues['iddoctype'] := '172606130001';
oraDataSet.Refresh;
if oraDataSet.RecordCount > 0 then
begin
field := oraDataSet.FieldByName('sSelectionName');
Assert(SameText(field.AsString,'SEL_PRL_QuotientPRCKPIDet')); // !!! Wrong
end;
function code:
Code: Select all
static function GetsKPITabGST(idpSelf in number) return varchar2
as
begin
for xvRow in (select t.sKPITabGST
from prl_doctype t
where t.id = idpSelf
and t.sKPITabGST is not null
)loop
return xvRow.sKPITabGST;
end loop;
return 'Select null as id'||chr(10)||
' ,''SEL_PRL_QuotientKPIDet'' as sSelectionName'||chr(10)||
' ,''CLList_idQuotientKPI'' as sRepresentationName'||chr(10)||
' ,''Показатели'' as sDisplayName'||chr(10)||
' ,null as nImage'||chr(10)||
' from dual';
end;sKPITabGST = Select null as id
,'SEL_PRL_QuotientPRCKPIDet' as sSelectionName
,'CLList_idQuotientKPI' as sRepresentationName
,'Показатели' as sDisplayName
,null as nImage
from dual