code: private String exportToSql() throws SQLException {
  
          StringBuilder sql = new StringBuilder();
          sql.append("--");
          sql.append("\n-- Generated by mysql-backup4j");
          sql.append("\n-- https://github.com/SeunMatt/mysql-backup4j");
          sql.append("\n-- Date: ").append(new SimpleDateFormat("d-M-Y H:m:s").format(new Date()));
          sql.append("\n--");
  
          //these declarations are extracted from HeidiSQL
          sql.append("\n\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;")
                  .append("\n/*!40101 SET NAMES utf8 */;")
                  .append("\n/*!50503 SET NAMES utf8mb4 */;")
                  .append("\n/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;")
                  .append("\n/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;");
  
  
          //get the tables that are in the database
          List<String> tables = MysqlBaseService.getAllTables(database, stmt);
  
          //for every table, get the table creation and data
          // insert statement
          for (String s: tables) {
              try {
                  sql.append(getTableInsertStatement(s.trim()));
                  sql.append(getDataInsertStatement(s.trim()));
              } catch (SQLException e) {
                  e.printStackTrace();
              }
          }
  
          sql.append("\n/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;")
                  .append("\n/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;")
                  .append("\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;");
  
          this.generatedSql = sql.toString();
          return sql.toString();
      }
docs: This is the entry function that'll
  coordinate getTableInsertStatement() and getDataInsertStatement()
  for every table in the database to generate a whole
  script of SQL
  @return String
  @throws SQLException exception