<commit_before>package pop

import (
	"fmt"
	"os/exec"

	_ "github.com/go-sql-driver/mysql"
	"github.com/markbates/going/clam"
	. "github.com/markbates/pop/columns"
	"github.com/markbates/pop/fizz"
	"github.com/markbates/pop/fizz/translators"
)

type MySQL struct {
	ConnectionDetails *ConnectionDetails
}

func (m *MySQL) Details() *ConnectionDetails {
	return m.ConnectionDetails
}

func (m *MySQL) URL() string {
	c := m.ConnectionDetails
	if c.URL != "" {
		return c.URL
	}

	s := "%s:%s@(%s:%s)/%s?parseTime=true&multiStatements=true"
	return fmt.Sprintf(s, c.User, c.Password, c.Host, c.Port, c.Database)
}

func (m *MySQL) MigrationURL() string {
	return m.URL()
}

func (m *MySQL) Create(store Store, model *Model, cols Columns) error {
	return genericCreate(store, model, cols)
}

func (m *MySQL) Update(store Store, model *Model, cols Columns) error {
	return genericUpdate(store, model, cols)
}

func (m *MySQL) Destroy(store Store, model *Model) error {
	return genericDestroy(store, model)
}

func (m *MySQL) SelectOne(store Store, model *Model, query Query) error {
	return genericSelectOne(store, model, query)
}

func (m *MySQL) SelectMany(store Store, models *Model, query Query) error {
	return genericSelectMany(store, models, query)
}

func (m *MySQL) CreateDB() error {
	c := m.ConnectionDetails
	cmd := exec.Command("mysql", "-u "+c.User, "-p"+c.Password, "-e", fmt.Sprintf("create database %s", c.Database))
	return clam.RunAndListen(cmd, func(s string) {
		fmt.Println(s)
	})
}

func (m *MySQL) DropDB() error {
	c := m.ConnectionDetails
	cmd := exec.Command("mysql", "-u"+c.User, "-p"+c.Password, "-e", fmt.Sprintf("drop database %s", c.Database))
	return clam.RunAndListen(cmd, func(s string) {
		fmt.Println(s)
	})
}

func (m *MySQL) TranslateSQL(sql string) string {
	return sql
}

func (m *MySQL) FizzTranslator() fizz.Translator {
	t := translators.NewMySQL(m.URL(), m.Details().Database)
	return t
}

func (m *MySQL) Lock(fn func() error) error {
	return fn()
}

func NewMySQL(deets *ConnectionDetails) Dialect {
	deets.Parse("3306")
	cd := &MySQL{
		ConnectionDetails: deets,
	}

	return cd
}<commit_msg>fixed mysql create/drop commands<commit_after>package pop

import (
	"fmt"
	"os/exec"

	_ "github.com/go-sql-driver/mysql"
	"github.com/markbates/going/clam"
	. "github.com/markbates/pop/columns"
	"github.com/markbates/pop/fizz"
	"github.com/markbates/pop/fizz/translators"
)

type MySQL struct {
	ConnectionDetails *ConnectionDetails
}

func (m *MySQL) Details() *ConnectionDetails {
	return m.ConnectionDetails
}

func (m *MySQL) URL() string {
	c := m.ConnectionDetails
	if c.URL != "" {
		return c.URL
	}

	s := "%s:%s@(%s:%s)/%s?parseTime=true&multiStatements=true"
	return fmt.Sprintf(s, c.User, c.Password, c.Host, c.Port, c.Database)
}

func (m *MySQL) MigrationURL() string {
	return m.URL()
}

func (m *MySQL) Create(store Store, model *Model, cols Columns) error {
	return genericCreate(store, model, cols)
}

func (m *MySQL) Update(store Store, model *Model, cols Columns) error {
	return genericUpdate(store, model, cols)
}

func (m *MySQL) Destroy(store Store, model *Model) error {
	return genericDestroy(store, model)
}

func (m *MySQL) SelectOne(store Store, model *Model, query Query) error {
	return genericSelectOne(store, model, query)
}

func (m *MySQL) SelectMany(store Store, models *Model, query Query) error {
	return genericSelectMany(store, models, query)
}

func (m *MySQL) CreateDB() error {
	c := m.ConnectionDetails
	cmd := exec.Command("mysql", "-u", c.User, "-p"+c.Password, "-e", fmt.Sprintf("create database %s", c.Database))
	return clam.RunAndListen(cmd, func(s string) {
		fmt.Println(s)
	})
}

func (m *MySQL) DropDB() error {
	c := m.ConnectionDetails
	cmd := exec.Command("mysql", "-u", c.User, "-p"+c.Password, "-e", fmt.Sprintf("drop database %s", c.Database))
	return clam.RunAndListen(cmd, func(s string) {
		fmt.Println(s)
	})
}

func (m *MySQL) TranslateSQL(sql string) string {
	return sql
}

func (m *MySQL) FizzTranslator() fizz.Translator {
	t := translators.NewMySQL(m.URL(), m.Details().Database)
	return t
}

func (m *MySQL) Lock(fn func() error) error {
	return fn()
}

func NewMySQL(deets *ConnectionDetails) Dialect {
	deets.Parse("3306")
	cd := &MySQL{
		ConnectionDetails: deets,
	}

	return cd
}
{'fraction_non_alphanumeric': 0.16099720410065238, 'fraction_numerical': 0.001863932898415657, 'mean_word_length': 4.6936339522546415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1383325', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1600, 'n_words': 398}