Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddb: MySQL support #4

Closed
yznts opened this issue Aug 8, 2024 · 4 comments
Closed

ddb: MySQL support #4

yznts opened this issue Aug 8, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@yznts
Copy link
Owner

yznts commented Aug 8, 2024

Provide initial mysql support

@yznts yznts added the enhancement New feature or request label Aug 8, 2024
@yznts
Copy link
Owner Author

yznts commented Aug 13, 2024

This might be challenging for multiple reasons:

  • Certificate support requires additional effort and not handled by driver's DSN parser
  • Go's mysql driver defaults to []uint8 on .Scan() to any type, so it doesn't actually resolve type

@yznts
Copy link
Owner Author

yznts commented Aug 13, 2024

Just to ensure, I've added types output for dsql in this way:

for _, row := range data.Rows {
	for _, element := range row {
		fmt.Printf("%v  ", reflect.TypeOf(element))
	}
	fmt.Println()
}

Using sakiladb/mysql and sakiladb/postgres as example.
Sample query: select * from address limit 1

For postgres, we're getting types correctly:

$ go run ./cmd/dsql "select * from address limit 1"
int64  string  <nil>  string  int64  <nil>  string  time.Time
...

But, for mysql we're getting this:

$ go run ./cmd/dsql "select * from address limit 1"
int64  []uint8  <nil>  []uint8  int64  []uint8  []uint8  []uint8  []uint8
...

@yznts
Copy link
Owner Author

yznts commented Aug 13, 2024

Related ticket: go-sql-driver/mysql#861

yznts added a commit that referenced this issue Aug 13, 2024
@yznts
Copy link
Owner Author

yznts commented Aug 13, 2024

Closing for now, with future improvements intention

@yznts yznts closed this as completed Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant