datafly icon indicating copy to clipboard operation
datafly copied to clipboard

Rowid functionality missing

Open sepi opened this issue 9 years ago • 3 comments

When inserting a row with an auto increment in sqlit3 for example, the newly created id as returned by sqlite3:last-insert-rowid (http://quickdocs.org/cl-sqlite/api) for the sqlite3 DBMS should be accessible. Sqlite3 does not support the RETURNING SQL clause. Alternatively, add possibility to use the last_insert_rowid() sql function in SxQl.

sepi avatar Dec 18 '15 01:12 sepi

As datafly is not an ORM, it's out of the scope.

fukamachi avatar Dec 18 '15 01:12 fukamachi

One stupid question: with PostgreSQL, how would you get the id of the newly created record?

 (with-connection (db :school)
   (execute
    (insert-into :students
       (set=
	     :last_name "Uzumaki"
	     :first_name "Naruto"
	     :address "Ever green st #598, Konoha"
       (returning :id)))))

I only get NIL from that

asarch avatar Jan 22 '21 19:01 asarch

@asarch Rather late, but try retrieve-one-value instead of execute.

rudolfochrist avatar Aug 11 '24 14:08 rudolfochrist