1

I am trying to update multiple values in a single row in an SQLite3 database using golang and the standard sql driver but am having trouble debugging the following error:

 command-line-arguments
./server.go:169: multiple-value updateStatement.Exec() in single-value context

The relevant code is as follows (irrelevant code has been omitted):

SQL Statement:

const (
    rsvpSubmit = "UPDATE rsvp SET Name = ?, Rsvp = ?, Guests = ?, Meal0 = ?, Meal1 = ?, Comments = ?, ModifiedAt = ? WHERE email = ?"
)

var (
    updateStatement *sql.Stmt
)

errr := updateStatement.Exec(
    r.FormValue("name"),
    r.FormValue("rsvp"),
    r.FormValue("guests"),
    r.FormValue("meal0"),
    r.FormValue("meal1"),
    r.FormValue("comments"),
    time.Now(),
    cookie.Value)

The database has the following columns (which the struct replicates):

    type User struct {
        Id         int
        Email      string
        Name       sql.NullString
        Rsvp       sql.NullInt64
        Guests     sql.NullInt64
        Meal0      sql.NullString
        Meal1      sql.NullString
        Comments   sql.NullString
        ModifiedAt sql.NullString
    }

Any help is greatly appreciated!

1 Answer 1

4

Stmt.Exec is defined as:

func (s *Stmt) Exec(args ...interface{}) (Result, error)

if you don't care about the result then you can use _, err := updateStatement.Exec(...)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.