Giter Club home page Giter Club logo

Comments (7)

iragsdale avatar iragsdale commented on May 22, 2024

BTW, I'm using gorp (https://github.com/coopernurse/gorp). There doesn't seem to be much happening between the exec & the RowsAffected call:

    res, err := exec.Exec(bi.query, bi.args...)
    if err != nil {
        return -1, err
    }

    rows, err := res.RowsAffected()
    if err != nil {
        return -1, err
    }

from go-sqlite3.

mattn avatar mattn commented on May 22, 2024

Could you please show me the code you have?

from go-sqlite3.

iragsdale avatar iragsdale commented on May 22, 2024

My code is just calling the Update method on a DBMap struct from the Gorp library, which really just seems to do an Exec & then call RowsAffected on the result. It also happens with the Insert method and LastInsertId.

Code is here: https://github.com/coopernurse/gorp/blob/master/gorp.go

If you want to look at my code, I'm happy to add you to the project - I'm planning on open sourcing it, just waiting on approval from the client.

from go-sqlite3.

mattn avatar mattn commented on May 22, 2024

I was fixed about LastInsertId in yesterday. Please check latest.

from go-sqlite3.

iragsdale avatar iragsdale commented on May 22, 2024

Sorry to take so long to test this out. That doesn't seem to have resolved the issue:

goroutine 21 [syscall]:
github.com/mattn/go-sqlite3._Cfunc__sqlite3_changes(0x0, 0xf840397a00)
github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:58 +0x2f
github.com/mattn/go-sqlite3.(_SQLiteResult).RowsAffected(0xf84039e8f8, 0xf8406dc160, 0x0, 0x0)
github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:264 +0x2e
database/sql.(_result).RowsAffected(0xf8406dc160, 0xf8400a2f00, 0xfc, 0xf840397a00)
/usr/local/go/src/pkg/database/sql/convert.go:0 +0x43

Any other suggestions?

from go-sqlite3.

mattn avatar mattn commented on May 22, 2024

github.com/mattn/go-sqlite3._Cfunc__sqlite3_changes(0x0, 0xf840397a00)

It seems that statement object is 0x0. Could you please show me your code?

from go-sqlite3.

iragsdale avatar iragsdale commented on May 22, 2024

I'm using the Gorp library. Code for the update method can be found here:
https://github.com/coopernurse/gorp/blob/master/gorp.go#L1078

I don't see any way for the result to be nil unless it somehow returns a nil result with a nil error - is that possible?

from go-sqlite3.

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.