Code Monkey home page Code Monkey logo

Comments (10)

zxy82005337 avatar zxy82005337 commented on July 17, 2024

my code like this
db.Exec("insert into LC_BATCHTRANS(BATCHID,AMOUNT,STATUS,FAMEBCUSNO,SUBMITTIME,SUBMITTLR,TRANSTYPE,ABS) values (?,?,?,?,?,?,?,?)", "test001", "0.01", "N", "002", time.Now(), "002", "0", "test")
but when the value of AMOUNT is less than 1,such as 0.01 or 0.10,the sql before can't take effect

from tds.

thda avatar thda commented on July 17, 2024

Hi,
Is your amount field a float or a numeric?
Can you give me the table's ddl?

from tds.

zxy82005337 avatar zxy82005337 commented on July 17, 2024

Hi,
Is your amount field a float or a numeric?
Can you give me the table's ddl?

decimal

from tds.

zxy82005337 avatar zxy82005337 commented on July 17, 2024

decimal
it has nothing to do with the type of field, when the sql is working,it will be stopped by the code in the 129 rows of num.go

from tds.

thda avatar thda commented on July 17, 2024

Indeed but I need the type of field to reproduce.

from tds.

zxy82005337 avatar zxy82005337 commented on July 17, 2024

the error info:
/usr/local/go/src/runtime/panic.go:35 (0x42afbd)
panicslice: panic(sliceError)
/var/www_edu_plugins/bank-api/src/sctek.com/edu-plugins/bank-api/vendor/github.com/thda/tds/num.go:129 (0xaadf4b)
Num.String: return string(b[:len(b)-2-int(n.scale)]) + "." + string(b[len(b)-2-int(n.scale):len(b)-2])
/var/www_edu_plugins/bank-api/src/sctek.com/edu-plugins/bank-api/vendor/github.com/thda/tds/num.go:186 (0xaae3e7)
numConverter.ConvertValue: return []byte(num.String()), err
/usr/local/go/src/database/sql/convert.go:83 (0x968fac)
ccChecker.CheckNamedValue: nv.Value, err = c.cci.ColumnConverter(index).ConvertValue(arg)
/usr/local/go/src/database/sql/convert.go:171 (0x97cb6b)
(ccChecker).CheckNamedValue-fm: checker = cc.CheckNamedValue
/usr/local/go/src/database/sql/convert.go:171 (0x97cb6b)
(ccChecker).CheckNamedValue-fm: checker = cc.CheckNamedValue
/usr/local/go/src/database/sql/convert.go:175 (0x9694b3)
driverArgsConnLocked: err = checker(nv)
/usr/local/go/src/database/sql/sql.go:2260 (0x977c8f)
resultFromStatement: dargs, err := driverArgsConnLocked(ci, ds, args)
/usr/local/go/src/database/sql/sql.go:1410 (0x97392b)
(*DB).execDC: return resultFromStatement(ctx, dc.ci, ds, args...)
/usr/local/go/src/database/sql/sql.go:1371 (0x973620)
(*DB).exec: return db.execDC(ctx, dc, dc.releaseConn, query, args)
/usr/local/go/src/database/sql/sql.go:1349 (0x973230)
(*DB).ExecContext: res, err = db.exec(ctx, query, args, cachedOrNewConn)
/usr/local/go/src/database/sql/sql.go:1363 (0x9734a4)
(*DB).Exec: return db.ExecContext(context.Background(), query, args...)

from tds.

zxy82005337 avatar zxy82005337 commented on July 17, 2024

Indeed but I need the type of field to reproduce.

the type of AMOUNT is DECIMAL (15,2)

from tds.

thda avatar thda commented on July 17, 2024

Thanks for the input. I should be able to provide a fix tomorrow. Will keep you updated

from tds.

thda avatar thda commented on July 17, 2024

I could reproduce.
I'll push an update tomorrow.

from tds.

thda avatar thda commented on July 17, 2024

Can you please test against Master?

from tds.

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.