You are not logged in.
Trying to save a blob in a TOrm object I arrived with a row in database where the blob content was '0'
Trying to debug it I noticed that fFieldsExternal in TRestStorageExternal was defined as follows:
(('id', 'int', 11, 11, 0, ftInt64, True), ('img', 'longblob /*!100301 compressed*/', 0, 0, 0, ftInt64, False))
This comment in field type as returned by the database because the field is automatically compressed by the database causes the trouble and defined it as ftInt64 instead of ftBlob
It is possible to ignore the comments in the definition in order not to have this trouble?
Thank you in advance
Last edited by dcoun (2022-09-16 08:00:00)
Offline
So this "100301 compressed" tag comes from the data provider itself.
Where is the actual problem (unit/method)?
Which way to you use to connect to MariaDB: ODBC? ZDBC? something else?
Offline
So this "100301 compressed" tag comes from the data provider itself.
Where is the actual problem (unit/method)?
In mormot2, longblob database field should have Columntype in TRestStorageExternal.fFieldsExternal as ftBlob, but as you can see in the code above, with this tag mormot2 has filled the longblob field's TSqlDBColumnDefine as int64 and Mormot2 can not save its contents in the database.
Which way to you use to connect to MariaDB: ODBC? ZDBC? something else?
ZeosDBC 8.0-patches from github
Last edited by dcoun (2022-09-15 19:36:40)
Offline
What I don't understand is that TSqlDBConnectionProperties.ColumnTypeNativeToDB should call ColumnTypeNativeDefault.
Then 'longblob /*!100301 compressed*/' should be recognized as ftBlob since only the first chars are checked by IdemPPChar().
Could you debug and see why it is not the case?
Offline
What I don't understand is that TSqlDBConnectionProperties.ColumnTypeNativeToDB should call ColumnTypeNativeDefault.
Then 'longblob /*!100301 compressed*/' should be recognized as ftBlob since only the first chars are checked by IdemPPChar().
Could you debug and see why it is not the case?
TSqlDBConnectionProperties.ColumnTypeNativeToDB is never called
Offline
So it makes sense. It seems to be a ZDBC/Zeos bug.
mORMot TSqlDBZeosConnectionProperties.GetFields calls IZDatabaseMetadata.GetColumn then convert the Zeos field type into the mORMot field type.
My guess is that a wrong column native type is given to TZSQLTypeToTSqlDBFieldType().
If it is confirmed, then you need to ask for a fix on the Zeos forum.
Offline
I was just to write it. Mormot2 depends on ZEOS for that
the problem is in line 714, of mormot.db.sql.zeos
F.ColumnType := TZSQLTypeToTSqlDBFieldType(
TZSQLType(res.GetInt(TableColColumnTypeIndex)));
in zdbintfs the res.GetInt returns wrong from zdbccache line 3001
thank you @ab
Offline
Perhaps https://github.com/synopse/mORMot2/commit/8fb8ac4c could circumvent the Zeos issue.
Offline
Thank you a lot @ab!!! It works OK now
Offline