Re: sqlite autoincrement row versus id NOT-autoincremented

2007-10-25 Thread [EMAIL PROTECTED]
Alexandr and Wayne ! you saved my life!! Thanks so much.. it's so simple I feel confused ^_^ I did not look closer to the spelling (and may have been tired of breaking my teeth) The trick is just to define the type of 'id' as INTEGER instead of INT (and to set it as PRIMARY) This is somet

Re: sqlite autoincrement row versus id NOT-autoincremented

2007-10-24 Thread Thiago Paes
In my applications, that i have using sqlite 2, add this solution: app_model: function getNextId() { $_max = $this->query("SELECT (MAX(id) + 1) AS id FROM {$this->table}"); $max = $_max[0][0]['id']; return ceil($max); } and, in for example, photos_controller.p

Re: sqlite autoincrement row versus id NOT-autoincremented

2007-10-24 Thread Grant Cox
That's "easy"? Sounds like a ridiculously over-complex idea to me... On Oct 25, 2:01 pm, Adwin Wijaya <[EMAIL PROTECTED]> wrote: > The easiest one :) > > create a table called counter with 2 field (or one,. deppend on you) > create table tcounter > :ctrtype "nameoftable" > :ctrvalue 0 > > when

Re: sqlite autoincrement row versus id NOT-autoincremented

2007-10-24 Thread Adwin Wijaya
The easiest one :) create a table called counter with 2 field (or one,. deppend on you) create table tcounter :ctrtype "nameoftable" :ctrvalue 0 when you want to save (inserting) ... get the ctrvalue from the tcounter first, and then insert the ctrvalue into your table :id (primary key). dont fo

Re: sqlite autoincrement row versus id NOT-autoincremented

2007-10-24 Thread Wayne Fay
David... read the URL you sent again, specifically: If a table contains a column of type INTEGER PRIMARY KEY, then that column becomes an alias for the ROWID. You can then access the ROWID using any of four different names, the original three names described above or the name given to the INTEGER

Re: sqlite autoincrement row versus id NOT-autoincremented

2007-10-24 Thread Olexandr Melnyk
You can have auto-incremented columns with SQLite. Define a single integer column as primary key and that should do the job. On 10/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hello all! > > I'm a re-newly cake user and I'm currently trying to make my cake > using a SQLite database.

sqlite autoincrement row versus id NOT-autoincremented

2007-10-24 Thread [EMAIL PROTECTED]
Hello all! I'm a re-newly cake user and I'm currently trying to make my cake using a SQLite database. I'll the 15minute blog tutorial as a reference. Now, once I get the database connected correctly (verified and working with bake script), I do a simple table : CREATE TABLE posts ( id INT UN