Read the MySQL charset-related system variables.
()
| 878 | |
| 879 | // Read the MySQL charset-related system variables. |
| 880 | func (e *Extractor) readMySqlCharsetSystemVariables() error { |
| 881 | query := `show variables where Variable_name IN ('character_set_server','collation_server')` |
| 882 | rows, err := e.db.Query(query) |
| 883 | if err != nil { |
| 884 | return err |
| 885 | } |
| 886 | defer rows.Close() |
| 887 | |
| 888 | // Show an example. |
| 889 | /* |
| 890 | mysql> SHOW VARIABLES WHERE Variable_name IN ('character_set_server','collation_server'); |
| 891 | +----------------------+-----------------+ |
| 892 | | Variable_name | Value | |
| 893 | +----------------------+-----------------+ |
| 894 | | character_set_server | utf8 | |
| 895 | | collation_server | utf8_general_ci | |
| 896 | +----------------------+-----------------+ |
| 897 | */ |
| 898 | e.systemVariables = make(map[string]string) |
| 899 | for rows.Next() { |
| 900 | var ( |
| 901 | variable string |
| 902 | value string |
| 903 | ) |
| 904 | |
| 905 | err = rows.Scan(&variable, &value) |
| 906 | |
| 907 | if err != nil { |
| 908 | return err |
| 909 | } |
| 910 | e.systemVariables[variable] = value |
| 911 | } |
| 912 | |
| 913 | if rows.Err() != nil { |
| 914 | return rows.Err() |
| 915 | } |
| 916 | |
| 917 | e.logger.Info("Reading MySQL charset-related system variables before parsing DDL history.") |
| 918 | return nil |
| 919 | } |
| 920 | |
| 921 | type TimestampContext struct { |
| 922 | stopCh chan struct{} |
no test coverage detected