Subject ATTENTION JASON Fwd: [IBO] Re: Size mismatch for field...
Author jwharton@ibobjects.com
Look in IBODataset.pas for the following method:

procedure TIBODataSet.CheckFieldCompatibility( Field: TField;
FieldDef: TFieldDef );
begin
if Field.DataType = ftFloat then Field.Size := 0;
if ( Field.DataType = ftBCD ) and ( Field.Size = 8 ) {Cover a past bug} then
Field.Size := FieldDef.Size;
if FieldDef.DataType = ftFloat then FieldDef.Size := 0;
if (( Field.DataType = ftLargeInt ) and ( FieldDef.DataType = ftInteger )) or
(( Field.DataType = ftInteger ) and ( FieldDef.DataType = ftLargeInt )) or
(( Field.DataType = ftBCD ) and ( FieldDef.DataType = ftLargeInt )) or
(( Field.DataType = ftBCD ) and ( FieldDef.DataType = ftInteger )) or
(( Field.DataType = ftBCD ) and ( FieldDef.DataType = ftFloat )) or
(( Field.DataType = ftFloat ) and ( FieldDef.DataType = ftLargeInt )) or
(( Field.DataType = ftFloat ) and ( FieldDef.DataType = ftInteger )) or
(( Field.DataType = ftFloat ) and ( FieldDef.DataType = ftBCD )) then
//Allow this type conversion to pass.
else
if ( Field.DataType = ftString ) and ( FieldDef.DataType = ftMemo ) then
//Allow this type conversion to pass.
begin
// Make sure it is really a string though.
if Field.DataSize >= MaxWord then
DatabaseErrorFmt( SFieldSizeMismatch,
[Field.DisplayName, Field.Size, FieldDef.Size],
Self );
end
else
inherited CheckFieldCompatibility( Field, FieldDef );
end;


Some simple adjustments to this to allow the existing values to pass should be all that is required. I thought I was having it
ignore whatever the settings are but apparently I am just having it ignore a particular value instead. MY thoughts are to
have it allow stuff for any size setting. IBO will determine its own values and override whatever is manually stored in the
DFM anyway. The error doesn't need to be raised at all.

Jason Wharton
www.ibobjects.com


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Jason,
This needs your attention.

Helen


>To: IBObjects@yahoogroups.com
>From: "fabiano_bonin" <fabiano@...>
>Date: Wed, 28 Jan 2004 10:48:00 -0000
>Subject: [IBO] Re: Size mismatch for field...
>
>Well, it seems nobody can help me. So it's impossible for me to
>upgrade to new version of IBO. I will be forced to use old 4.2.
>
>I'd like to be refunded for the payment i did for the upgrade, if
>you don't mind.
>
>--- In IBObjects@yahoogroups.com, "fabiano_bonin" <fabiano@p...>
>wrote:
> > > I don't know what your story is. It's a long time since I used
> > BCD fields
> > > but, AFAIR, you always had this error if the scale of the stored
> > numeric or
> > > decimal was smaller than the BCD precision setting.
> >
> > I think my story isn't different from others. I just use 'add all
> > fields' within TIBOQuery and it adds the BCD fields. I don't know
>a
> > way (or why) of don't use BCD fields.
> >
> > Ok, i did a simple test case that maybe help somebody to identify
> > what is causing the problem.
> >
> > First of all, i created this table:
> >
> > create table bcd_test (
> > field1 numeric(5,2) );
> >
> > Then, i created a new project in Delphi, added a TIBODatabase and
>a
> > TIBOQuery in the form.
> > After setup the TIBODatabase, i changed the SQL property of the
> > TIBOQuery to 'select * from bcd_test'.
> > So i double-clicked the TIBOQuery, right-clicked the fields editor
> > and selected 'Add all fields'.
> >
> > I did the same step above with both 4.2Gc and 4.3Aa.
> >
> > Below are 3 DFM's:
> > A) generated with IBO 4.2Gc
> > B) generated with IBO 4.3Ga
> > C) same as A), but after the project was opened with IBO 4.3Ga
> > (nothing changed)
> >
> > As you can note, the field generated with IBO 4.2Gc is a
> > TIBOBCDField, while the field generated with IBO 4.3Ga is a
> > TBCDField. Is it a known behavior change?
> >
> > A) generated with IBO 4.2Gc
> >
> > object Form1: TForm1
> > Left = 192
> > Top = 114
> > Width = 696
> > Height = 480
> > Caption = 'Form1'
> > Color = clBtnFace
> > Font.Charset = DEFAULT_CHARSET
> > Font.Color = clWindowText
> > Font.Height = -11
> > Font.Name = 'MS Sans Serif'
> > Font.Style = []
> > OldCreateOrder = False
> > PixelsPerInch = 96
> > TextHeight = 13
> > object IBODatabase1: TIBODatabase
> > SQLDialect = 3
> > Params.Strings = (
> > 'PATH=teste'
> > 'USER NAME=SYSDBA'
> > 'SQL DIALECT=3'
> > 'SERVER=interbase.leonilda.com.br'
> > 'PROTOCOL=TCP/IP')
> > Left = 8
> > Top = 8
> > end
> > object IBOQuery1: TIBOQuery
> > Params = <>
> > DatabaseName = 'interbase.leonilda.com.br:teste'
> > IB_Connection = IBODatabase1
> > RecordCountAccurate = True
> > SQL.Strings = (
> > 'select * from bcd_test')
> > FieldOptions = []
> > Left = 40
> > Top = 8
> > object IBOQuery1FIELD1: TIBOBCDField
> > FieldName = 'FIELD1'
> > end
> > end
> > end
> >
> >
> > B) generated with IBO 4.3Ga
> >
> > object Form1: TForm1
> > Left = 192
> > Top = 114
> > Width = 696
> > Height = 480
> > Caption = 'Form1'
> > Color = clBtnFace
> > Font.Charset = DEFAULT_CHARSET
> > Font.Color = clWindowText
> > Font.Height = -11
> > Font.Name = 'MS Sans Serif'
> > Font.Style = []
> > OldCreateOrder = False
> > PixelsPerInch = 96
> > TextHeight = 13
> > object IBODatabase1: TIBODatabase
> > SQLDialect = 3
> > Params.Strings = (
> > 'SERVER=interbase.leonilda.com.br'
> > 'PATH=teste'
> > 'PROTOCOL=TCP/IP'
> > 'USER NAME=SYSDBA'
> > 'SQL DIALECT=3')
> > Left = 8
> > Top = 8
> > end
> > object IBOQuery1: TIBOQuery
> > Params = <>
> > DatabaseName = 'interbase.leonilda.com.br:teste'
> > IB_Connection = IBODatabase1
> > RecordCountAccurate = True
> > SQL.Strings = (
> > 'select * from bcd_test')
> > FieldOptions = []
> > Left = 40
> > Top = 8
> > object IBOQuery1FIELD1: TBCDField
> > FieldName = 'FIELD1'
> > Precision = 9
> > Size = 2
> > end
> > end
> > end
> >
> >
> > C) same as A), but after the project was opened with IBO 4.3Ga
> > (nothing changed)
> >
> > object Form1: TForm1
> > Left = 192
> > Top = 114
> > Width = 696
> > Height = 480
> > Caption = 'Form1'
> > Color = clBtnFace
> > Font.Charset = DEFAULT_CHARSET
> > Font.Color = clWindowText
> > Font.Height = -11
> > Font.Name = 'MS Sans Serif'
> > Font.Style = []
> > OldCreateOrder = False
> > PixelsPerInch = 96
> > TextHeight = 13
> > object IBODatabase1: TIBODatabase
> > SQLDialect = 3
> > Params.Strings = (
> > 'PATH=teste'
> > 'USER NAME=SYSDBA'
> > 'SQL DIALECT=3'
> > 'SERVER=interbase.leonilda.com.br'
> > 'PROTOCOL=TCP/IP')
> > Left = 8
> > Top = 8
> > end
> > object IBOQuery1: TIBOQuery
> > Params = <>
> > DatabaseName = 'interbase.leonilda.com.br:teste'
> > IB_Connection = IBODatabase1
> > RecordCountAccurate = True
> > SQL.Strings = (
> > 'select * from bcd_test')
> > FieldOptions = []
> > Left = 40
> > Top = 8
> > object IBOQuery1FIELD1: TIBOBCDField
> > FieldName = 'FIELD1'
> > end
> > end
> > end
>
>
>___________________________________________________________________________
>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
>
>To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
>To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
>
>Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/