// GetCreateTableSQL returns the create table statement.
GetCreateTableSQL returns the create table statement.
// GetCreateTableSQL returns the create table statement .
func GetCreateTableSQL(ctx context.Context, db *sql.DB, schemaName string, tableName string) (string, error) {
	query := fmt.Sprintf("SHOW CREATE TABLE `%s`.`%s`", schemaName, tableName)
	var tbl, createTable sql.NullString
	err := db.QueryRowContext(ctx, query).Scan(&tbl, &createTable)
	if err != nil {
		return "", errors.Trace(err)
	}
	if !tbl.Valid || !createTable.Valid {
		return "", errors.NotFoundf("table %s", tableName)
	}
	return createTable.String, nil
}
func GetCreateTableSQL ( ctx context . Context , db * sql . DB , schemaName string , tableName string ) ( string , error ) { query := fmt . Sprintf ( " " , schemaName , tableName ) var tbl , createTable sql . NullString err := db . QueryRowContext ( ctx , query ) . Scan ( & tbl , & createTable ) if err != nil { return " " , errors . Trace ( err ) } if ! tbl . Valid || ! createTable . Valid { return " " , errors . NotFoundf ( " " , tableName ) } return createTable . String , nil }
GetCreateTableSQL returns the create table statement.
GetCreateTableSQL returns the create table statement .
/*
		show create table example result:
		mysql> SHOW CREATE TABLE `test`.`itest`;
		+-------+--------------------------------------------------------------------+
		| Table | Create Table                                                                                                                              |
		+-------+--------------------------------------------------------------------+
		| itest | CREATE TABLE `itest` (
			`id` int(11) DEFAULT NULL,
		  	`name` varchar(24) DEFAULT NULL
			) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |
		+-------+--------------------------------------------------------------------+
	*/