Subject | ATTENTION JASON Fwd: [IBO] Re: Size mismatch for field... |
---|---|
Author | jwharton@ibobjects.com |
Post date | 2004-02-06T07:12:39Z |
Here is a way to open this up and be more flexible.
Please try applying this change, rebuild all package files.
Then let me know how it goes.
In IBODataset.pas around line 7020:
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
begin
Field.Size := FieldDef.Size;
if Field is TBCDField then
with Field as TBCDField do
Precision := FieldDef.Precision;
end;
...
Jason Wharton
www.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
Please try applying this change, rebuild all package files.
Then let me know how it goes.
In IBODataset.pas around line 7020:
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
begin
Field.Size := FieldDef.Size;
if Field is TBCDField then
with Field as TBCDField do
Precision := FieldDef.Precision;
end;
...
Jason Wharton
www.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