LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-11-2006, 11:14 AM   #1
blackman890
Member
 
Registered: Oct 2004
Location: Iceland
Posts: 90

Rep: Reputation: 15
SQLite how to get last "AUTO INCREMENT" value


Hello there, I have been programming for quite some time now (getting a little tired) and I have one question;

in SQLite you can set a column as INTEGER PRIMARY KEY and when inserting valus that contain nothing in this column, it will automatic set that value (kinda like AUTO INCREMENT in SQL);

However I would like to retreave that value the SQLite automatic made;
How is that possible?;


Sincerely = Jonatan;

Last edited by blackman890; 12-11-2006 at 11:18 AM.
 
Old 12-11-2006, 01:22 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,858
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

According to this article, you should basically be able to do a "select" from SQLITE_SEQUENCE:

http://www.sqlite.org/autoinc.html

SUGGESTION:
1. Create a couple of temporary tables
2. Explicitly specify "AUTOINCREMENT" in your primary indexes for each
3. Check "SQLLITE_SEQUENCE", your new row's key, and its ROWID for the *first* entry in the table.
4. Add a few more rows, alternating between the temporary tables.
5. See what happens.

'Hope that helps .. PSM
 
  


Reply

Tags
sqlite


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash equivalent to C increment operator andrewb758 Linux - General 5 02-21-2009 12:25 PM
Increment Files System's size Hep Linux - General 3 07-12-2006 03:21 PM
increment in hex snutz411 Linux - Newbie 2 11-01-2005 05:54 PM
Successful login from locked screen causes pam_tally to increment. Why? mzmyewski Linux - Security 2 03-03-2005 09:25 AM
PHP set of variables increment? Ctawp Programming 6 06-18-2004 01:03 PM


All times are GMT -5. The time now is 05:26 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration