[sqlite] Auto Increment of Integer Primary Key

2007-08-13 Thread Sreedhar.a
Hi, I am working with sqlite 3.3.6 version. I have defined the macro SQLITE_OMIT_FLOATING_POINT. 1. this is my test program "create table Test(id integer primary key,player char);" "insert into Test(id,player) values(2,'surya');" "insert into Test(id,player) values(9223372036854775807,'sree')

Re: [sqlite] Auto Increment?

2006-01-31 Thread Carl Jacobs
> Quoting Dennis Cote ([EMAIL PROTECTED]): > > Doesn't this mean that SQLite only supports 2^63 rows with autoincrement? > > That means you can insert one row per millisecond for 29 million years. Well actually, not quite. The website states that the database size is limited to 2^41 bytes. http://

Re: [sqlite] Auto Increment?

2006-01-31 Thread Paul Tomblin
Quoting Dennis Cote ([EMAIL PROTECTED]): > Doesn't this mean that SQLite only supports 2^63 rows with autoincrement? That means you can insert one row per millisecond for 29 million years. -- Paul Tomblin <[EMAIL PROTECTED]> http://xcski.com/blogs/pt/ In any business, the customer is always righ

Re: [sqlite] Auto Increment?

2006-01-31 Thread Dennis Cote
[EMAIL PROTECTED] wrote: The rowid does *not* wrap if you specify AUTOINCREMENT. Once the maximum rowid is used, all subsequent insert attempts return SQLITE_FULL. The regression test suite contains a test for this. Different rules apply if you do not use AUTOINCREMENT. There is a #define th

Re: [sqlite] Auto Increment?

2006-01-31 Thread drh
Dennis Cote <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > > > > >Hmmm... In the later versions of sqlite with 64-bit ROWID values, doesn't it > >treat them as unsigned? It sure seems that autoincremented rowid values > >should always be positive...??? > > > > > > > No, SQLite tr

Re: [sqlite] Auto Increment?

2006-01-31 Thread Dennis Cote
Jim C. Nasby wrote: On Tue, Jan 31, 2006 at 10:05:47AM -0700, Dennis Cote wrote: [EMAIL PROTECTED] wrote: CREATE TABLE x(i INTEGER PRIMARY KEY AUTOINCREMENT CHECK(i < (1<<32))); I suspect you'll see better performance if you hard-code the value instead of doing a bit-shift every time

Re: [sqlite] Auto Increment?

2006-01-31 Thread Dennis Cote
[EMAIL PROTECTED] wrote: Hmmm... In the later versions of sqlite with 64-bit ROWID values, doesn't it treat them as unsigned? It sure seems that autoincremented rowid values should always be positive...??? No, SQLite treats them as 64 bit signed integers. The first 2^63 values are posit

Re: [sqlite] Auto Increment?

2006-01-31 Thread Jim C. Nasby
On Tue, Jan 31, 2006 at 10:05:47AM -0700, Dennis Cote wrote: > [EMAIL PROTECTED] wrote: > CREATE TABLE x(i INTEGER PRIMARY KEY AUTOINCREMENT CHECK(i < (1<<32))); I suspect you'll see better performance if you hard-code the value instead of doing a bit-shift every time you insert. -- Jim C. Nasby,

Re: [sqlite] Auto Increment?

2006-01-31 Thread Derrell . Lipman
Dennis Cote <[EMAIL PROTECTED]> writes: > Derrell, > > If you are using SQLite 3.3.0 or newer then you can do the same thing in a > more direct manner using a CHECK constraint. > > CREATE TABLE x(i INTEGER PRIMARY KEY AUTOINCREMENT CHECK(i < (1<<32))); Hehe. I'm using 2.8.16 for most of my work,

Re: [sqlite] Auto Increment?

2006-01-31 Thread Dennis Cote
[EMAIL PROTECTED] wrote: chetana bhargav <[EMAIL PROTECTED]> writes: Auto increment seems to return a unsigned long long is there any way for it to make it as 32 bit, as I am depending on this feilds to generate unique id, and i have a constraint fot the id to be 32 bit only. You'll

Re: [sqlite] Auto Increment?

2006-01-31 Thread Derrell . Lipman
chetana bhargav <[EMAIL PROTECTED]> writes: > Auto increment seems to return a unsigned long long is there any way for it > to make it as 32 bit, as I am depending on this feilds to generate unique > id, and i have a constraint fot the id to be 32 bit only. You'll have to add enough rows to the t

[sqlite] Auto Increment?

2006-01-31 Thread chetana bhargav
Auto increment seems to return a unsigned long long is there any way for it to make it as 32 bit, as I am depending on this feilds to generate unique id, and i have a constraint fot the id to be 32 bit only. __ Do You Yahoo!? Tired of spam? Yahoo

Re: [sqlite] Auto Increment?

2006-01-30 Thread Gerry Snyder
Clint Bailey wrote: Can you set up a field to auto-increment, and if so how? Details are in the fourth paragraph of: http://sqlite.org/lang_createtable.html Summary: create table tbl(fieldname integer primary key autoincrement, ...) HTH, Gerry

Re: [sqlite] Auto Increment?

2006-01-30 Thread rbundy
| | cc: | | Subject: [sqlite] Auto Increment? | >--| Can

[sqlite] Auto Increment?

2006-01-30 Thread Clint Bailey
Can you set up a field to auto-increment, and if so how?

Re: [sqlite] auto increment

2003-12-12 Thread D. Richard Hipp
Felipe Lopes wrote: I would like to know what SQL command should I use to have a field auto increment? I've tried the same way I do on mysql (primary key, not null and auto increment) but didn't work...How can it be done on sqlite? (I'm programming with php) http://www.sqlite.org/faq.html#q1

Re: [sqlite] auto increment

2003-12-12 Thread Kurt Welgehausen
- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

[sqlite] auto increment

2003-12-12 Thread Felipe Lopes
Hi there! I would like to know what SQL command should I use to have a field auto increment? I've tried the same way I do on mysql (primary key, not null and auto increment) but didn't work...How can it be done on sqlite? (I'm programming with php) Thanx in advance Felipe Lopes.

Re: [sqlite] Auto-Increment field for primary key

2003-12-03 Thread Derrell . Lipman
"Pierre-Yves Delens" <[EMAIL PROTECTED]> writes: > What is the easiest way to install an Auto-Increment field for primary key > in a SqLite database ? If the primary key is of type INTEGER and you insert a new record with NULL for that field, it will use the next available integer value -- effect

[sqlite] Auto-Increment field for primary key

2003-12-03 Thread Pierre-Yves Delens
Bonjour, What is the easiest way to install an Auto-Increment field for primary key in a SqLite database ? My context : Win2000 ; PySqLite, with access from ODBC and from DbManager for acquiring data. Thanks on forward PS : alternatively (if no solution to my main question), is there a way to m

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Darren Duncan
Kevin said: >OK, that sounds fine, but is it possible to determine the type of field so my script >will be able to add the quotes if it is of type INTEGER? > >Kind regards >Kevin Probably the best thing to do is use bind variables when inserting non-hardcoded values into your SQL. Bind variables

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Kevin Waterson
This one time, at band camp, Kurt Welgehausen <[EMAIL PROTECTED]> wrote: > (1) You could take a look at the typeof() funciton. Is there documentation on this? Kind regards Kevin -- __ (_ \ _) )

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Kurt Welgehausen
(1) You could take a look at the typeof() funciton. (2) You don't put quotes around a literal number in SQL. You can get away with it in SQLite because it stores everything (almost) as a string, but you really shouldn't do it. Regards -

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Greg Obleshchuk
Kevin Waterson To: [EMAIL PROTECTED] Sent: Monday, October 20, 2003 10:59 AM Subject: Re: [sqlite] AUTO INCREMENT This one time, at band camp, "Ian VanDerPoel" <[EMAIL PROTECTED]> wrote: > You can find the info you want in the sqlite_master > table. Ther

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Kevin Waterson
This one time, at band camp, "Ian VanDerPoel" <[EMAIL PROTECTED]> wrote: > You can find the info you want in the sqlite_master > table. There is some doco on it at the sqlite.org the website. I am not sure if the > info is held anywhere else but > select * from sqlite_master where name = quot

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Ian VanDerPoel
>>> Kevin Waterson <[EMAIL PROTECTED]> 20/10/2003 >>>OK, that sounds fine, but is it possible to determine the type of field so my script will be able to add the quotes if it is of type INTEGER? >>>Kind regards Kevin, You can find the info you want in the sqlite_master table. There is som

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Kevin Waterson
This one time, at band camp, Kevin Waterson <[EMAIL PROTECTED]> wrote: > OK, that sounds fine, but is it possible to determine the type of field so my script > will be able to add the quotes if it is of type INTEGER? I guess what I really need is something like MySQL's mysql_field_type() Kind r

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Kevin Waterson
This one time, at band camp, "Ian VanDerPoel" <[EMAIL PROTECTED]> wrote: > INSERT INTO quotes (id, author, quote, category) VALUES (NULL, 'blah', 'blah', > 'blah') > > > Remove the quotes around the NULL OK, that sounds fine, but is it possible to determine the type of field so my script wil

Re: [sqlite] AUTO INCREMENT

2003-10-19 Thread Ian VanDerPoel
>>> Kevin Waterson <[EMAIL PROTECTED]> 20/10/2003 9:17:26 am >>> I have a table that looks like this.. # #SQLite Admin Structure Dump for table quotes # create table quotes(id INTEGER PRIMARY KEY, author varchar(50), quote TEXT, category varchar(20)) I am trying to auto increment the id field wi

[sqlite] AUTO INCREMENT

2003-10-19 Thread Kevin Waterson
I have a table that looks like this.. # #SQLite Admin Structure Dump for table quotes # create table quotes(id INTEGER PRIMARY KEY, author varchar(50), quote TEXT, category varchar(20)) I am trying to auto increment the id field with this query INSERT INTO quotes (id, author, quote, category) VAL