> > (require db)
> > (define db (postgresql-connect ...args...))
> > (simple-result-info (query db "insert into collaborations (name) values
> ('foojalskdsfls')"))
> '((insert-id . #f) (affected-rows . 1))
>
With postgresql instead of doing a plain insert you can use returning to
return your id:
(assuming your collaborations table has a id field that is automatically
initialized)
> (query-row db "insert into collaborations (name) values ('foojalskdsfls')
returning id")
'#(3) ;; the id of your inserted row
see returning in the postgres-documentation:
https://www.postgresql.org/docs/9.5/sql-insert.html
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.