Bug 145552 - Unable to copy a table with a photo column from a Base HSQLDB embedded database to a Base database connected to MySQL.
Summary: Unable to copy a table with a photo column from a Base HSQLDB embedded databa...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-05 08:45 UTC by Jean-Paul
Modified: 2023-12-16 10:20 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Paul 2021-11-05 08:45:49 UTC
Description:
When trying to copy a table with a photo column from an embedded database into a MySQL directly connected database, an error message appears : No corresponding column type could be found for column 'Photo'.


Steps to Reproduce:
1. Open Base and create a new database (embedded HSQLDB)
2. Use Wizard to Create Table
3. category : Business /  Sample Tables : Employees
4. select fields : LastName and Photo
5. Set type and formats : click Next
6. Set primary key : Automatically add a primary key / check AutoValue
7. click Finish
8. Open Base and connect to an existing database : MySQL / connect directly
9. Setup a connection to a MySQL database (database name and server/port). As an example, use the sample MySQL database  name sakila
10. Copy/Paste the table from the embedded Base to the MySQL connected Base.


Actual Results:
Error message :  No corresponding column type could be found for column 'Photo'.


Expected Results:
I expect the table Employees to be copied into the MySQL connected Base.



Reproducible: Always


User Profile Reset: No



Additional Info:
It seems that Base does not support fields defined as "photo" in the Table creation Wizard (appearing as image(logvarbin))    when the backend database is MySQL.
Comment 1 Robert Großkopf 2021-11-20 10:21:46 UTC
Will be the same problem as all the bugs about field types, which aren't supported at this moment:
bug 145205
bug 145714
bug 132515
Comment 2 Julien Nabet 2021-11-20 19:15:10 UTC
Searching about "No corresponding column type could be found for column", I found:
dbaccess/inc/strings.hrc:307:#define STR_UNKNOWN_TYPE_FOUND                      NC_("STR_UNKNOWN_TYPE_FOUND", "No corresponding column type could be found for column '#1'." )

From STR_UNKNOWN_TYPE_FOUND:
1525 void OCopyTableWizard::showColumnTypeNotSupported(std::u16string_view _rColumnName)
1526 {
1527     OUString sMessage( DBA_RES( STR_UNKNOWN_TYPE_FOUND ) );
1528     sMessage = sMessage.replaceFirst("#1",_rColumnName);
1529     showError(sMessage);
1530 }

on gdb, when putting a break in the function, I got:

#0  dbaui::OCopyTableWizard::showColumnTypeNotSupported(std::basic_string_view<char16_t, std::char_traits<char16_t> >) (this=0x49e76c0, _rColumnName=u"Photo") at dbaccess/source/ui/misc/WCopyTable.cxx:1527
#1  0x00007fdd6ebf268d in dbaui::OWizColumnSelect::createNewColumn(weld::TreeView*, dbaui::OFieldDescription const*, std::__debug::vector<rtl::OUString, std::allocator<rtl::OUString> >&, rtl::OUString const&, rtl::OUString const&, int, comphelper::UStringMixEqual const&)
    (this=0x64609b0, _pListbox=0x4ccd020, _pSrcField=0x5ae0460, _rRightColumns=std::__debug::vector of length 3, capacity 4 = {...}, _sColumnName="Photo", _sExtraChars="#@", _nMaxNameLen=64, _aCase=...)
    at dbaccess/source/ui/misc/WColumnSelect.cxx:297
#2  0x00007fdd6ebf147b in dbaui::OWizColumnSelect::moveColumn(weld::TreeView*, weld::TreeView const*, std::__debug::vector<rtl::OUString, std::allocator<rtl::OUString> >&, rtl::OUString const&, rtl::OUString const&, int, comphelper::UStringMixEqual const&)
    (this=0x64609b0, _pRight=0x4ccd020, _pLeft=0x55f2270, _rRightColumns=std::__debug::vector of length 3, capacity 4 = {...}, _sColumnName="Photo", _sExtraChars="#@", _nMaxNameLen=64, _aCase=...)
    at dbaccess/source/ui/misc/WColumnSelect.cxx:312
#3  0x00007fdd6ebf1081 in dbaui::OWizColumnSelect::ButtonClickHdl(weld::Button&) (this=0x64609b0, rButton=...) at dbaccess/source/ui/misc/WColumnSelect.cxx:213
#4  0x00007fdd6ebefc70 in dbaui::OWizColumnSelect::LinkStubButtonClickHdl(void*, weld::Button&) (instance=0x64609b0, data=...) at dbaccess/source/ui/misc/WColumnSelect.cxx:158

when taking a look at frame 1, I see:
    274 void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
    275                                         OFieldDescription const * _pSrcField,
    276                                         std::vector< OUString>& _rRightColumns,
    277                                         const OUString&  _sColumnName,
    278                                         const OUString&  _sExtraChars,
    279                                         sal_Int32               _nMaxNameLen,
    280                                         const ::comphelper::UStringMixEqual& _aCase)
    281 {
    282     OUString sConvertedName = m_pParent->convertColumnName(TMultiListBoxEntryFindFunctor(&_rRightColumns,_aCase),
    283                                                                 _sColumnName,
    284                                                                 _sExtraChars,
    285                                                                 _nMaxNameLen);
    286     OFieldDescription* pNewField = new OFieldDescription(*_pSrcField);
    287     pNewField->SetName(sConvertedName);
    288     bool bNotConvert = true;
    289     pNewField->SetType(m_pParent->convertType(_pSrcField->getSpecialTypeInfo(),bNotConvert));
    290     if ( !m_pParent->supportsPrimaryKey() )
    291         pNewField->SetPrimaryKey(false);
    292 
    293     _pListbox->append(OUString::number(reinterpret_cast<sal_Int64>(pNewField)), sConvertedName);
    294     _rRightColumns.push_back(sConvertedName);
    295 
    296     if ( !bNotConvert )
    297         m_pParent->showColumnTypeNotSupported(sConvertedName);
    298 }

which shows that we must dig into "convertType" since it's the only one which can modify bNotConvert to false  (see https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/misc/WCopyTable.cxx?r=8ee18d0b&mo=51518&fi=1408#1408).

This method can call until 3 times getTypeInfoFromType (see https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/misc/UITools.cxx?r=8a017d25#263)
Comment 3 Julien Nabet 2021-11-20 19:32:18 UTC
The copy of the same table from hsqldb to Firebird works so something specific to Mysql part.
Comment 4 Julien Nabet 2021-11-21 10:50:16 UTC
For fb, LONGVARBINARY info are retrieved when clicking on Tables part on left panel:
#0  connectivity::firebird::ODatabaseMetaData::getTypeInfo()::$_0::operator()() const (this=0x7fff57e99958) at connectivity/source/drivers/firebird/DatabaseMetaData.cxx:898
#1  0x00007f6d7ba0829e in connectivity::firebird::ODatabaseMetaData::getTypeInfo() (this=0x67a2980) at connectivity/source/drivers/firebird/DatabaseMetaData.cxx:816
#2  0x00007f6d7ba0e7ed in non-virtual thunk to connectivity::firebird::ODatabaseMetaData::getTypeInfo() () at connectivity/source/drivers/firebird/DatabaseMetaData.cxx:1029
#3  0x00007f6d7b9f6624 in connectivity::firebird::Connection::buildTypeInfo() (this=0x568f9c0) at connectivity/source/drivers/firebird/Connection.cxx:880
#4  0x00007f6d7b9f6434 in connectivity::firebird::Connection::createStatement() (this=0x568f9c0) at connectivity/source/drivers/firebird/Connection.cxx:402
#5  0x00007f6d7ba12763 in connectivity::firebird::ODatabaseMetaData::getTables(com::sun::star::uno::Any const&, rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<rtl::OUString> const&)
    (this=0x67a2980, tableNamePattern="%", types=uno::Sequence of length 2 = {...}) at connectivity/source/drivers/firebird/DatabaseMetaData.cxx:1327
#6  0x00007f6d7ba137e5 in non-virtual thunk to connectivity::firebird::ODatabaseMetaData::getTables(com::sun::star::uno::Any const&, rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<rtl::OUString> const&) () at connectivity/source/drivers/firebird/DatabaseMetaData.cxx:1322
#7  0x00007f6d7b9e8094 in connectivity::firebird::Catalog::refreshTables() (this=0x67a7d10) at connectivity/source/drivers/firebird/Catalog.cxx:32
#8  0x00007f6d8d693b56 in connectivity::sdbcx::OCatalog::getTables() (this=0x67a7d10) at connectivity/source/sdbcx/VCatalog.cxx:81
#9  0x00007f6d8d693cad in non-virtual thunk to connectivity::sdbcx::OCatalog::getTables() () at connectivity/source/sdbcx/VCatalog.cxx:87
#10 0x00007f6d7efc0ffb in dbaccess::OConnection::refresh(com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> const&) (this=0x678fa60, _rToBeRefreshed=
    uno::Reference to (dbaccess::OTableContainer *) 0x67a68c8) at dbaccess/source/core/dataaccess/connection.cxx:528
#11 0x00007f6d7efc159c in dbaccess::OConnection::getTables() (this=0x678fa60) at dbaccess/source/core/dataaccess/connection.cxx:560
#12 0x00007f6d7efbe4fe in dbaccess::OConnection::impl_checkTableQueryNames_nothrow() (this=0x678fa60) at dbaccess/source/core/dataaccess/connection.cxx:751
#13 0x00007f6d7efbdfd2 in dbaccess::OConnection::OConnection(dbaccess::ODatabaseSource&, com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x678fa60, _rDB=..., _rxMaster=uno::Reference to (connectivity::firebird::Connection *) 0x568fa28, _rxORB=
    uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x228c970) at dbaccess/source/core/dataaccess/connection.cxx:339
#14 0x00007f6d7f03d24b in dbaccess::ODatabaseSource::buildIsolatedConnection(rtl::OUString const&, rtl::OUString const&) (this=0x5278670, user="", password="")
    at dbaccess/source/core/dataaccess/datasource.cxx:1219

it's not the case for mysqlc.

Lionel: I wonder if it's not a pb of implementing specific sdb/sdbc/sdbcx.
If you've got some ideas, don't hesitate of course! :-)
Comment 5 QA Administrators 2023-11-22 03:13:53 UTC Comment hidden (obsolete)
Comment 6 Alex Thurgood 2023-12-08 10:02:12 UTC
Bug still present in

Version: 7.6.2.1 (AARCH64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 8; OS: Mac OS X 14.1.1; UI render: Skia/Raster; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 7 Jean-Paul 2023-12-16 10:20:16 UTC
Bug still present in 

Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_BE); UI: en-US
Calc: CL threaded