> (require db)
> (define db (postgresql-connect  ...args...))
> (simple-result-info (query db "insert into collaborations (name) values
('foojalskdsfls')"))
'((insert-id . #f) (affected-rows . 1))

>From the docs on the 'simple-result' struct:

"Represents the result of a SQL statement that does not return a relation,
such as an INSERT or DELETE statement.

The info field is an association list, but its contents vary based on
database system and may change in future versions of this library (even new
minor versions). The following keys are supported for multiple database
systems:

-

'insert-id: If the value is a positive integer, the statement was an INSERT
statement and the value is a system-specific identifier for the inserted
row. For PostgreSQL, the value is the row’s OID, if the table has OIDs (for
an alternative, see the INSERT ... RETURNING statement). For MySQL, the
value is the same as the result of last_insert_id
<http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_last-insert-id>
function—that is, the value of the row’s AUTO_INCREMENT field. If there is
no such field, the value is #f. For SQLite, the value is the same as the
result of the last_insert_rowid
<http://www.sqlite.org/lang_corefunc.html#last_insert_rowid> function—that
is, the ROWID <http://www.sqlite.org/lang_createtable.html#rowid> of the
inserted row."


I get the same results with a SQLite connection -- the insert-id is always
#f.  I know that it says the contents may change and that it varies per
database, but it also specifically calls out 'insert-id as a thing that is
supported for both of these DBs.  What am I missing?

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to