Subject | RE: [IBO] TIB_ColumnText and strings that are too long |
---|---|
Author | Jason Wharton |
Post date | 2006-01-10T15:22:29Z |
The ADO components were some of the worst and buggiest components Borland
has produced so I surely am not going to model IBO after them.
I could make a ColumnAttribute you set once at the connection level or
dataset level and then it causes all string based assignments to validate in
this way.
Jason
has produced so I surely am not going to model IBO after them.
I could make a ColumnAttribute you set once at the connection level or
dataset level and then it causes all string based assignments to validate in
this way.
Jason
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of Martijn Tonies
> Sent: Monday, January 09, 2006 11:46 PM
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] TIB_ColumnText and strings that are too long
>
>
> Hello Jason,
>
>
> > I designed it to work the way it does. To my knowledge
> other component
> sets
> > also work this way.
>
> Well, ADO, for one, doesn't.
>
> > 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.
>
> The thing is, as I wrote earlier, as a user, I do not know -
> until I get
> back my data
> from the database - that is has been cut off, while if I
> would have gotten a
> database
> error, it would have been clear from the start.
>
> Could this behaviour be optional? (default ON not to annoy
> other IBO users,
> or
> perhaps default OFF to make sure errors happen when they should?)
>
> 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
>
>
> > 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