ziutek/mymysql — Issue #14: MYSQL_TYPE_NEWDECIMAL and large numbers
Author: aimxhaisse
Created: 2012-03-04 10:51:51+00:00
State: open

Sorry to bother you again, but here's another case that triggers an error, this happens when using large numbers (I'm still using godrv) :

var v int64
sql = "select sum(4123232323232) as test"
row := db.QueryRow(sql)
err = row.Scan(&v)
checkErr(t, err)

Which results in the following:

driver_test.go:14: Error: sql: Scan error on column index 0: converting string "4.123232323232e+12" to a int64: strconv.ParseInt: parsing "4.123232323232e+12": invalid syntax

Using strconv.ParseFloat(string(data), 64), this error isn't triggered because it handles that notation. The problem seems to trigger only with MYSQL_TYPE_NEWDECIMAL types, as a "select 4123232323232" works.