[Gambas-user] Database Edit error with SQlite

Benoit Minisini gambas at ...1...
Thu Sep 2 21:45:58 CEST 2004


On Thursday 02 September 2004 21:16, ron wrote:
> On Thursday 02 September 2004 20:20, Benoit Minisini wrote:
> > On Thursday 02 September 2004 09:02, ron wrote:
> > > On Wednesday 01 September 2004 21:22, Benoit Minisini wrote:
> > > > On Wednesday 01 September 2004 05:02, Jeff Johnson wrote:
> > > > > Were you ever able to figure out anything on the sqlite
> > > > > edit/update?
> > > >
> > > > Yes: you must define a primary key in your table.
> > >
> > > Is this a requirement for gambas or for sqllite
> >
> > This is a requirement for the Connection.Edit() method.
>
> So for all db types? lite mysql and postgre.
>
> This is for mysql wrong. you can have table without key.
> Or it must be changed in version 4.x against 3.x
>
> I had working table without any key working as far I know.
> It's a pitty I can't verify it atm. the HD with the tables
> is on vacation by my brother.
>
> Ok I create table with phpmyadmin
> 2 records no key's and be able to update the record
> the sql shown is
> UPDATE `tab2`
>   SET `active` = '1'
>   WHERE `id` = '0'
>     AND `name` = 'first'
>     AND `birth` = '2004-09-02 21:09:49'
>     AND `active` = '0'
>     AND CONCAT( `salary` ) = '0'
>   LIMIT 1 ;
>
> what to do in my company if the table has 10.000.000 records
> (the spam email db) :-)
>

This has nothing to do with the DBMS. Just that Connection.Edit() needs a 
primary to work, that's all - Read the source if you want to see why :-)

Or give me a ROWID in every DBMS. SQLite has a ROWID, so theorically a primary 
key is not needed in this case.

Anyway, no primary key in a table is a bad database design.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list