Coder Social home page Coder Social logo

Comments (9)

methane avatar methane commented on July 20, 2024

I'm open, but please don't assume I will merge it.
Please be clear about edge cases and backward compatibility.

from mysql.

derekperkins avatar derekperkins commented on July 20, 2024

Do you feel that the current test cases are sufficient to cover edge cases and backwards compatibility?

from mysql.

methane avatar methane commented on July 20, 2024

I don't know.

from mysql.

dolmen avatar dolmen commented on July 20, 2024

@derekperkins Have you tried filling a Config (use NewConfig) with your settings and call its FormatDSN method to see what it outputs? I expect that your case is already handled (I see a call to url.PathEscape in the code).

Here is a template: https://go.dev/play/p/8E3WFHsTTJc

from mysql.

derekperkins avatar derekperkins commented on July 20, 2024

@dolmen I'm not using this driver directly, I'm configuring the backing grafana database. That being said, I've been using the single url option, so maybe setting the individual fields will have a better outcome

https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#url

from mysql.

dolmen avatar dolmen commented on July 20, 2024

@derekperkins mysql://username:password@host:1234/dbname/0?interpolateParams=true is not a valid DSN for the MySQL driver. Our DSN doesn't have that mysql:// prefix. It looks like Grafana has another DSN layer over it. You should start investigating there first.

from mysql.

dolmen avatar dolmen commented on July 20, 2024

Our README says:

dbname is escaped by PathEscape() since v1.8.0. If your database name is dbname/withslash

... but v1.8.0 is not yet released.

This is commit d3e4fe6 from #1432.

So the issue is fixed, but not released yet.

from mysql.

derekperkins avatar derekperkins commented on July 20, 2024

Looks like Grafana does a url parse
https://github.com/grafana/grafana/blob/41e3b3bea2d91f9da38d65bfee89f321499ea3f9/pkg/services/sqlstore/sqlstore.go#L471-L491

Then fmt it into a go-sql-driver compatible DSN
https://github.com/grafana/grafana/blob/16d0aff26707b80fda408708d1c67bb2fe0586e9/pkg/services/sqlstore/sqlstore.go#L283-L317C33

I also checked with https://github.com/xo/usql, which uses https://github.com/xo/dburl to parse the agnostic string, and it returned the same error from go-sql-driver.

I can test it out directly to see if it works going straight through the driver

from mysql.

derekperkins avatar derekperkins commented on July 20, 2024

So the issue is fixed, but not released yet.

Oh, awesome - sorry for not seeing your comment before I posted. Thanks for tracking down that PR @dolmen and thanks @methane for the implementation!

from mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.