Subject | RE: [IBO] TIB_ColumnText and strings that are too long |
---|---|
Author | Jason Wharton |
Post date | 2006-01-10T04:20:47Z |
I designed it to work the way it does. To my knowledge other component sets
also work this way.
The best way to get an error message is to write a generic validation
routine. It could be a procedure that assigns an open string value to a
TIB_Column and inside it will do the check.
Jason
also work this way.
The best way to get an error message is to write a generic validation
routine. It could be a procedure that assigns an open string value to a
TIB_Column and inside it will do the check.
Jason
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of Martijn Tonies
> Sent: Monday, January 09, 2006 4:18 AM
> To: ibobjects@yahoogroups.com
> Subject: [IBO] TIB_ColumnText and strings that are too long
>
>
> Hi,
>
> I'm using a TIB_DSQL component and parameters to insert data
> into a table.
>
> I have a VARCHAR(20) defined in the database.
>
> Now I'm assigning a value of length 60 to it.
>
> It did not generate an error.
>
> So, I started looking through IBO-source. It seems that TIB_ColumnText
> only moves the "sqllen" characters into the buffer:
>
> procedure TIB_ColumnText.SetValue( const NewValue: string );
> var
> tmpVal: string;
> strLen: integer;
> begin
> tmpVal := NewValue;
> SysBeforeModify;
> case CharCase of
> ccUpper: tmpVal := AnsiUpperCase( tmpVal );
> ccLower: tmpVal := AnsiLowerCase( tmpVal );
> end;
> if not Row.IsKeyFields then
> ApplyTrimming( tmpVal, Trimming );
> strLen := Length( tmpVal );
> FillChar( FNewColumnBuffer^, DataSize, FPadChar );
> if ( strLen = 0 ) and FBlankIsNull then
> SysSetIsNull( true )
> else
> begin
> SysSetIsNull( false );
>
> /* here!! */
>
> if strLen > SQLLen then
> strLen := SQLLen;
> Move( tmpVal[1], FNewColumnBuffer^, strLen );
> end;
> SysAfterModify;
> end;
>
> If the string is too long, it will only copy "SQLLen" number of
> characters...
>
> All fine and dandy, but I WANT it to return an error. How
> else would I know
> that my data
> has been cut off?
>
> Any ideas?
>
> Martijn Tonies
> Database Workbench - tool for InterBase, Firebird, MySQL,
> Oracle & MS SQL
> Server
> Upscene Productions
> http://www.upscene.com
> Database development questions? Check the forum!
> http://www.databasedevelopmentforum.com
>
>
>
> ______________________________________________________________
> _____________
> IB Objects - direct, complete, custom connectivity to
> Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ______________________________________________________________
> _____________
> http://www.ibobjects.com - your IBO community resource for
> Tech Info papers,
> keyword-searchable FAQ, community code contributions and more
> !
> Yahoo! Groups Links
>
>
>
>
>
>
>