Giter Site home page Giter Site logo

Comments (7)

hgfischer avatar hgfischer commented on May 9, 2024

FYI: I've had to fork and reset to beta3 to make it work again. I plan to delete my fork when this is fixed.

from mysql.

julienschmidt avatar julienschmidt commented on May 9, 2024

While the database/sql package is able to convert from int* -> *string, it is unable to convert to *[]byte. This is not specific to *sql.RawBytes. Also this is not a driver issue.

Before beta 4 this driver returned every value as []byte. For int* values this means converting the []byte (Little Endian representation) from the stream to an integer value, formatting it as a string and return the string as []byte (string representation this time) again, which obviously has a lot of overhead.

According to the database/sql/driver specification it is completely fine to return an int64 value.
So we can skip the string formatting an converting string -> []byte part.
Therefor this is an driver/sql package issue. I'm working on a fix anyways.

For all that, your query should work fine in go tip / Go 1.1, where the Queryer driver interface is available. This allows this driver to run queries without args with the MySQL text protocol (In Go 1 every query must use prepared statements, which use the binary protocol) where everything is already returned in string representation, which is why everything is still returned as a []byte value.

from mysql.

julienschmidt avatar julienschmidt commented on May 9, 2024

Hotfix for $GOROOT/src/pkg/database/sql/convert.go (Go 1.0.3)

Patch: http://files.julienschmidt.com/public/gostuff/convert.go.patch
Fixed File: http://files.julienschmidt.com/public/gostuff/convert.go

After replacing delete the folder $GOROOT/pkg/<arch>/database/ and run go test -i in $GOROOT/src/pkg/database/sql/ then

I send out a CL for go later. I'm on my Notebook. I must set up gcc + hg + codereview tool first :)

from mysql.

hgfischer avatar hgfischer commented on May 9, 2024

πŸ‘ Thank you for all the explanation, the patch, and your time! πŸ’―

I'll probably wait for Go 1.1 to get back using to your repo since I don't need too much performance for my small tool right now and Go 1.1 is right near the corner.

from mysql.

julienschmidt avatar julienschmidt commented on May 9, 2024

https://codereview.appspot.com/7783046

from mysql.

arnehormann avatar arnehormann commented on May 9, 2024

Merged in tip since devel +1ec96e11707f, yay!!!

from mysql.

hgfischer avatar hgfischer commented on May 9, 2024

πŸ‘ congratz!

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.