On Wed, 28 Sep 2016 06:30:05 -0700 (PDT)
Harry <hiroma...@gmail.com> wrote:

> > In a nutshell, Scan() internally performs several nested type
> > switches based on the type of the Scan destination and what is
> > received from the database (in other words, the driver). 
> >
> > As to why the two scans returned values of different types, more 
> > information is needed. But since the queries were similar and the
> > dest were the same, you could start by looking at what is stored in
> > the database and what's the int64/[]byte returned. 
> >
> These two SQL expect same result.
> 
> Field1's type on MySQL is int.
> When returning value as string type, that value is same to int value
> after asserted to int.
> But it's troublesome to handle two different result by placeholder 
> added/not added.

I would take tcpdump / Wireshark, capture the exchange with the server
in both cases and look at what Wireshark's dissectors decode from that
exchange in both cases.  If there's some information delivered by the
server along with its response (it should, I'd think), you'll be able
to see how it differs.  Alternatively, you should be able to tell any
difference between how the MySQL driver on the Go side handles the
query in both the cases.  This one is interesting.  Say, the driver
might actually prepare the query behind your back.  Or it may do
something weird when escaping the argument when constructing the full
query string if it's not using prepared statements.

To recap, there are at least two points of interest to look at.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to