Hmm.. don't know sed or awk, but I suppose this weekend would be a good time
to learn!

Alright, going along with this, is there a better way to get the last row id
inserted?  This is my (completely inefficient) workaround:

- - - - -

sqlite3 $dbfilename << EOF

INSERT INTO tablename (col1, col2) VALUES ("foovaluoo", 3.14159265);

.output t_rowid.tmp
SELECT LAST_INSERT_ROWID() FROM $db_table LIMIT 1;

.quit
EOF

read tehrowish < t_rowid.tmp
rm t_rowid.tmp

- - - - -

Basically, I want to insert something into the DB, then get the row id of
that insertion.  I know I have to do it in one session, otherwise
LAST_INSERT_ROWID() returns 0.
-- 
View this message in context: 
http://www.nabble.com/Capturing-output-from-SQLlite-with-variables-in-a-BASH-script-tf3966729.html#a11260834
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to