Subject | Re: [IBO] Re: Right-trimming defaults |
---|---|
Author | Jason Wharton |
Post date | 2001-03-23T02:46:35Z |
David,
WideStrings are to be handled separately. There already is an AsWideString
property. I suppose what may need to be added is an AsRawWideString
property. This is getting messy...
Yes, that should be word instead of smallint. Thanks.
BestFieldName is like FieldName its just that if you have a join where a
column name alone may be ambiguous, this will also include the table name if
needed. In most cases, it just returns the field name for simple queries.
Thanks for the comments.
Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
WideStrings are to be handled separately. There already is an AsWideString
property. I suppose what may need to be added is an AsRawWideString
property. This is getting messy...
Yes, that should be word instead of smallint. Thanks.
BestFieldName is like FieldName its just that if you have a join where a
column name alone may be ambiguous, this will also include the table name if
needed. In most cases, it just returns the field name for simple queries.
Thanks for the comments.
Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "David Trudgett" <dkt@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, March 22, 2001 7:41 PM
Subject: Re: [IBO] Re: Right-trimming defaults
> At 2001-03-22 18:44 -0700, "Jason Wharton" <jwharton@...> wrote:
>
> >Have a look at these methods.. This should do it:
>
> I haven't looked much at the internals of IBO before, so take my comments,
> or lack thereof, with a grain of salt.
>
>
> >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 );
>
> How do multi-byte character sets get handled? Obviously, for starters,
> we're just dealing with AnsiStrings at the moment. Will future versions
> have to use WideStrings for Unicode support?
>
>
> > end
> > else
> > Result := AsString;
> > end;
> >end;
>
> That looks like it will do the job.
>
>
>
> >procedure TIB_Column.SetAsRawString( const NewValue: string );
> >var
> > StrLen: smallint;
>
> Shouldn't that be "word" also?
>
> > 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 );
>
> I don't know where BestFieldName is coming from, but it sounds
interesting...
>
> I've got no problem with the exception being raised. Putting square pegs
> into round holes didn't work even in kindy.
>
>
> > 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;
>
>
> Thanks!
>
>
> David Trudgett
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>