https://bugs.documentfoundation.org/show_bug.cgi?id=146471
--- Comment #1 from Julien Nabet <[email protected]> --- Some analysis shows that to display tables, ODatabaseMetaData::getTables is called and it goes in the else part of this block: 1339 // TODO: GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM 1340 if (!types.hasElements() || (types.getLength() == 1 && types[0].match(wld))) 1341 { 1342 // All table types? I.e. includes system tables. 1343 queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1) "); 1344 } 1345 else 1346 { 1347 queryBuf.append("( (0 = 1) "); 1348 for (OUString const & t : types) 1349 { 1350 if (t == "SYSTEM TABLE") 1351 queryBuf.append("OR (RDB$SYSTEM_FLAG = 1 AND RDB$VIEW_BLR IS NULL) "); 1352 else if (t == "TABLE") 1353 queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NULL) "); 1354 else if (t == "VIEW") 1355 queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NOT NULL) "); 1356 else 1357 throw SQLException(); // TODO: implement other types, see above. 1358 } 1359 queryBuf.append(") "); 1360 } when trying to remove the table, it goes in the if part. see: https://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/firebird/DatabaseMetaData.cxx?r=5b20bb65#1347 Now investigating about RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1, these values come from src/jrd/constants.h 214 // relation types 215 216 enum rel_t { 217 rel_persistent = 0, 218 rel_view = 1, 219 rel_external = 2, 220 rel_virtual = 3, 221 rel_global_temp_preserve = 4, 222 rel_global_temp_delete = 5 223 }; so we retrieve rel_persistent (for "regular" tables and views) but we need rel_external. => diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx index f63468f0813f..c8356a32a82b 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx @@ -1339,8 +1339,10 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // TODO: GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM if (!types.hasElements() || (types.getLength() == 1 && types[0].match(wld))) { + // from Firebird: src/jrd/constants.h + // rel_persistent = 0, rel_view = 1, rel_external = 2 // All table types? I.e. includes system tables. - queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1) "); + queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1 OR RDB$RELATION_TYPE = 2) "); } else { After this first change, we got now a popup error when trying to delete the table: irebird_sdbc error: *Dynamic SQL Error *SQL error code = -104 *Token unknown - line 1, column 6 *"EXT1" caused by 'isc_dsql_prepare' /home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Util.cxx:68 The pb is again in the function ODatabaseMetaData::getTables some lines below when trying to retrieve the value of sTableType: 1397 OUString sTableType; 1398 1399 if (nSystemFlag == 1) 1400 { 1401 sTableType = "SYSTEM TABLE"; 1402 } 1403 else if (aIsView) 1404 { 1405 sTableType = "VIEW"; 1406 } 1407 else 1408 { 1409 if (nTableType == 0) 1410 sTableType = "TABLE"; 1411 } Since nTableType = 2, sTableType stays empty and some debugging shows that the DROP command generated is incomplete. -- You are receiving this mail because: You are the assignee for the bug.
