[Pushed] DB show_fields_from() method's return varies in format for different db engines
#1
The function show_fields_from($table) that shows the "show fields from" command for a specific table returns results in different formats for different db engines. It makes some particular uses of this function fail, for example, the merge system's column length calculation (https://github.com/mybb/merge-system/pull/260 ).

For mysql (now deprecated) and mysqli, the method directly uses SQL SHOW FIELDS FROM table_name to query, the results have columns (on MySQL 5.7) "Field", "Type", "Null", "Key", "Default", "Extra" and returns them.
mysql: https://github.com/mybb/mybb/blob/mybb_1....php#L1111
mysqli: https://github.com/mybb/mybb/blob/mybb_1....php#L1105

For pqsql and sqlite, the method uses some different SQL queries to get an intermediate result and reformat it as the final results that have columns "Field", "Extra" and returns them. It's worth noting that the two methods have different results in the "Extra" field. For pgsql, the information of column types is totally forgotten.
pqsql: https://github.com/mybb/mybb/blob/mybb_1....php#L1134
sqlite: https://github.com/mybb/mybb/blob/mybb_1...e.php#L954

IMO we could use the skeleton of MySQL's SHOW FIELDS FROM's result to format results of pqsql and sqlite.
Could be wrong but worth a try.
Reply
#2
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/4166

Thanks for contributing to MyBB!

Regards,
The MyBB Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)