nomorelogic
le 13 février 2016
à 15:33
|
Re : gestinux trunk database structure
I think I’ve found something but still confused too.
Starting from the begin, my environment is :
mysql (innodb_version) 5.6.28
zeoslib 7.1.4
Different from yours but trouble I think is in FPC, cause I use Lazarus trunk wich uses FPC 3 instead of Lazarus 1.2.6 wich uses fpc 2.6.4.
In .../fpc/packages/fcl-db/src/base/db.pas there no changes : order is not changed, ftBlob = 15 in both cases
db.pas in fpc 2.6.4
TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord,
ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime,
ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar,
ftWideString, ftLargeint, ftADT, ftArray, ftReference,
ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface,
ftIDispatch, ftGuid, ftTimeStamp, ftFMTBcd, ftFixedWideChar, ftWideMemo);
db.pas in fpc 3.0
TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord,
ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime,
ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar,
ftWideString, ftLargeint, ftADT, ftArray, ftReference,
ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface,
ftIDispatch, ftGuid, ftTimeStamp, ftFMTBcd, ftFixedWideChar, ftWideMemo);
there’s something new in fpc 3, but this shoulnd’t break
{ TBlobField }
TBlobStreamMode = (bmRead, bmWrite, bmReadWrite);
// This type is needed for compatibility. While it should contain only blob
// types, it actually does not.
// Instead of this, please use ftBlobTypes
TBlobType = ftBlob..ftWideMemo deprecated 'Warning: Does not contain BLOB types. Please use ftBlobTypes.';
TBlobField = class(TField)
strange to me is that in unitdatamodule.lfm, SqlCode is defined as ftBlob and not as ftMemo !
I thought about RTTI troubles and I checked in sourceforce, code is following : BlobType = ftBlob.
So, I can’t figure out why I get thi error while you don’t.
object TableQueriesSqlCode: TMemoField
DisplayWidth = 10
FieldKind = fkData
FieldName = 'SqlCode'
Index = 3
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = True
BlobType = ftBlob
Transliterate = False
end
Anyway I fixed that way, it works, but I have not figured out why 🙂
how is your lfm ?
ftMemo {$IFDEF VER3_0}, ftBlob{$ENDIF}: if aProtocol = Dbms_pgsql then
Result := 'TEXT'
else
Result := 'LONGTEXT';
|
tintinux
le 13 février 2016
à 17:39
|
Re : gestinux trunk database structure
You are right, SqlCode should have a BlobType to ftMemo and not ftBlob since it contains only text.
I will correct this, and you should no more have a ftBlob for this field.
I suppose that the FPC (or ZeosLib) version I have returns somewhere ftMemo when ftBlob is found, while yours don’t. That is why I never had the problem.
In table Products, for example, there is a field Picture having a BlobType to ftBlob.
This sounds logical for an image, but it works like this (for me) creating MySQL fields of type TEXT, because Gestinux always save images to database as XPM.
XPM is text and this allow to export image to a SQL script in plain text. With other image types, we could have binary content, leading to trouble.
Anyway I’m afraid you’ll get the same error on this field (if you don’t fix as proposed).
My solution is to correct also the type of this field to ftMemo, and in any other place where ftBlob is used : it should work on your environment without other changes.
You proposed fix make MySQL field of type TEXT when BlobType is ftBlob.
I don’t know if it works. Did you tried storing and retrieving data ?
If it works, I don’t find it very consistant.
I would suggest to return BLOB when BlobType is ftBlob, but we have to check if the upgrade from 1.2 to trunk works fine, in recent(s) versions of MySql and PostGreSQL.
IMHO, my solution is simpler and have less unknown consequences.
What do you think ?
Best regards
|