Bug 145714 - in Base, the mediumblob MySQL fields are shown as Text[VARCHAR] - no mysql connector native driver support for MEDIUMBLOB datatype.
Summary: in Base, the mediumblob MySQL fields are shown as Text[VARCHAR] - no mysql co...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.0 all versions
Hardware: All All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:7.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-16 11:50 UTC by Jean-Paul
Modified: 2021-12-19 19:35 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot with direct MySQL connector (87.29 KB, image/jpeg)
2021-11-16 11:53 UTC, Jean-Paul
Details
screenshot with MySQL jdbc connector (94.62 KB, image/jpeg)
2021-11-16 11:53 UTC, Jean-Paul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Paul 2021-11-16 11:50:51 UTC
Description:
When editing a MySQL table (accessed with the direct MySQL connector) in Base, the mediumblob fields are shown as Text[VARCHAR] instead of Image[MEDIUMBLOB].  



Steps to Reproduce:
1. Use the direct MySQL connector to access MySQL.
2. Use  Base SQL tool to :
   CREATE TABLE `test-blobs` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Photo1` longblob,
  `Photo2` mediumblob,
  `Photo3` blob,
  PRIMARY KEY (`ID`) )
3. click on Tables, select the table just created, right click to "edit"

Actual Results:
all fields are shown as expected, except the mediumblob field (Photo2) which is shown as Text[VARCHAR].


Expected Results:
all fields are shown as expected, including the mediumblob field (Photo2) which is shown as Image[MEDIUMBLOB].


Reproducible: Always


User Profile Reset: No



Additional Info:
Note : This problem only happens if the connector to the external MySQL is direct. It does if happen if the connector is MySQL-jdbc.
Comment 1 Jean-Paul 2021-11-16 11:53:05 UTC
Created attachment 176281 [details]
screenshot with direct MySQL connector
Comment 2 Jean-Paul 2021-11-16 11:53:54 UTC
Created attachment 176282 [details]
screenshot with MySQL jdbc connector
Comment 3 Jean-Paul 2021-11-17 08:21:54 UTC
I did some more research on this problem. It seems that some MySQL data types are not supported by the mysql native connector driver. 

Here is a list of some of these fields : 

MYSQL field type   Actual BASE field type   Expected BASE field type

  bit()              Date [DATE]              Binary(fix) [BIT]
  mediumblob         Text [VARCHAR]           Image [MEDIUMBLOB]
  mediumtext         Text [VARCHAR]           Memo [MEDIUMTEXT]
  tinyblob           Text [VARCHAR]           Image [TINYBLOB]
  tinytext           Text [VARCHAR]           Memo [TINYTEXT]
  year               Text [VARCHAR]           Date [YEAR]


The problem with the bit type is reported as bug 145205.
Comment 4 Julien Nabet 2021-11-17 20:28:56 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 5 Julien Nabet 2021-11-18 12:12:50 UTC
I gave a try with:
https://gerrit.libreoffice.org/c/core/+/125472

Jean-Paul: as indicated in the patch waiting for review:
"
I let aside YEAR (see https://mariadb.com/kb/en/year-data-type/) because it seems there's no LO Datatype which could correspond in https://opengrok.libreoffice.org/xref/core/offapi/com/sun/star/sdbc/DataType.idl?r=2b383d19
"
Comment 6 Commit Notification 2021-11-20 13:22:54 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2d445f90dbecf8d2240474dcb06084868ceb921a

tdf#145714: teach "mediumblob" to Mysql/MariaDB part in LO

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Julien Nabet 2021-12-19 19:35:17 UTC
Let's put this one to FIXED.