Web lists-archives.com

filename-safe conversion of database-/tablenames




Hello,

In order to do MySQL-dumps to a file on a Linux system under

    $BACKUP_DIR/$DB_NAME/$TABLE_NAME.sql

I need to convert both the names of databases and tables in a filename-safe way (escaping "/" and other characters as in [1]). The mapping of MySQL database/table name to the according filenames should preferably be the same that MySQL (or the particular DB engine) uses. If that's not possible the mapping should at least be injective and preferably be human readable.

I found out that MySQL is using the C-function tablename_to_filename(...) [2] internally but didn't find a way in which it exposes this conversion function to the outside.

Did I overlook some way this could be done? If not, would this be a feature that a future version of MySQL should provide?


Best regards
Simon Fromme


[1]: https://dev.mysql.com/doc/refman/5.7/en/identifier-mapping.html
[2]: http://osxr.org:8080/mysql/source/sql/sql_table.cc

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql