Skip to content

database/sql: ? vs $ inconsistency #3602

@rsc

Description

@rsc
do we care that you have to use different wild cards depending on the back end?




---------- Forwarded message ----------
From: zeroc8 <arnold.angerer@zeroc8.com>
Date: Tue, May 8, 2012 at 2:03 PM
Subject: [go-nuts] Re: Postgres pq - LastInsertId
To: golang-nuts@googlegroups.com

Am Dienstag, 8. Mai 2012 11:19:13 UTC+2 schrieb Alexander Neumann:
>
> Try something like this (untested):
>
> err := db.QueryRow("INSERT INTO foo (bar) VALUES ($1) RETURNING id;",
> bar).Scan(&id)
>
>
Thanks, works.
err := tx.QueryRow("insert into car(name) values($1) returning
id","test").Scan(&id)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions