Skip to content

Add Sqlserver database support#51

Open
tendant wants to merge 5 commits into
fraenky8:masterfrom
tendant:sqlserver-database-support
Open

Add Sqlserver database support#51
tendant wants to merge 5 commits into
fraenky8:masterfrom
tendant:sqlserver-database-support

Conversation

@tendant
Copy link
Copy Markdown

@tendant tendant commented Dec 6, 2022

Add SQL Server database support

vendor/ folder is not included in this patch.

@fraenky8
Copy link
Copy Markdown
Owner

Thanks for that! Will take a look soon, probably next week!

Copy link
Copy Markdown
Owner

@fraenky8 fraenky8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly some naming and vendor changes.

Did you try your changes? Does it work? Since I don't have any experience working with SQLServer I have to trust you on this one.

Comment thread pkg/database/sqlserver.go
Comment on lines +13 to +14
// Sqlserver implements the Database interface with help of GeneralDatabase.
type Sqlserver struct {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread pkg/database/sqlserver.go
}

// DSN creates the DSN String to connect to this database.
func (ss *Sqlserver) DSN() string {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a unit test for that? I see the other database implementation have one, just for the sake of consistency?

Comment thread pkg/database/sqlserver.go
if ss.Settings.User != "" {
user = ss.Settings.User
}
return fmt.Sprintf("server=%s;port=%s;user=%s;database=%s;password=%s",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to connect via a socket to SQLServer? I see MySQL and PG have this option. Can you check and add it here as well?

Comment thread pkg/database/sqlserver.go
// columns of a specific table for a given database.
func (ss *Sqlserver) PrepareGetColumnsOfTableStmt() (err error) {

ss.GetColumnsOfTableStmt, err = ss.Preparex(`
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be double sure, since I don't have any experience with SQLServer - this statement is the same as for PG except the placeholder format?

Comment thread go.mod
@@ -14,7 +14,11 @@ require (

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run go mod tidy and go mod vendor to include the vendor changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants