Subject Re: [IBO] Re: Right-trimming defaults
Author Jason Wharton
Have a look at these methods.. This should do it:

function TIB_Column.GetAsRawString: string;
var
tmpLen: word;
begin
if FNewColumnInd^ = IB_NULL then
Result := ''
else
case SQLType of
SQL_Text,
SQL_Text_:
Result := Copy( Pchar( FNewColumnBuffer ), 1, SQLLen );
SQL_Varying,
SQL_Varying_: with SQL_VARCHAR( FNewColumnBuffer^ ) do
begin
tmpLen := vary_len_low + vary_len_high * 256;
SetLength( Result, tmpLen );
Move( vary_string, pchar( Result )^, tmpLen );
end
else
Result := AsString;
end;
end;

procedure TIB_Column.SetAsRawString( const NewValue: string );
var
StrLen: smallint;
tmpVal: string;
begin
tmpVal := NewValue;
StrLen := Length( tmpVal );
case SQLType of
SQL_Text,
SQL_Text_:
begin
if StrLen > SQLLen then
raise Exception.Create( 'String truncation: ' + BestFieldName );
SysBeforeModify;
FillChar( FNewColumnBuffer^, DataSize, FPadChar );
if ( StrLen = 0 ) and FBlankIsNull then
SysSetIsNull( true )
else
SysSetIsNull( false );
Move( tmpVal[1], FNewColumnBuffer^, StrLen );
SysAfterModify;
end;
SQL_Varying,
SQL_Varying_: with SQL_VARCHAR( FNewColumnBuffer^ ) do
begin
if StrLen > SQLLen then
raise Exception.Create( 'String truncation: ' + BestFieldName );
SysBeforeModify;
FillChar( vary_string, SQLLen, FPadChar );
if ( StrLen = 0 ) and FBlankIsNull then
SysSetIsNull( true )
else
SysSetIsNull( false );
vary_len_low := StrLen mod 256;
vary_len_high := StrLen div 256;
Move( tmpVal[1], vary_string, StrLen );
SysAfterModify;
end
else
AsString := tmpVal;
end;
end;


Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com