[Gambas-user] Re(x3): fields limit? (primary key)

Benoit Minisini gambas at ...1...
Fri Jan 25 20:04:15 CET 2008


On vendredi 25 janvier 2008, Nx GT-R BOY wrote:
> >It seems that this sql statement is incorrect. There should be something
> >between SELECT and FROM, shouldn't it?
>
> Yes, of course, there's a problem at SELECT <nothing here> FROM asistencia
> LIMIT 64.  (Any known reason?)
>
> >Did you add a primary key to your table? This is mandatory in most part of
>
> the
>
> >Gambas database things.
>
> Yes, of course, I have added a primary key (I designed everything with
> DBDesigner4.x, that helps a lot), but the primary key is FOREIGN
>
> My table structure is:
> CREATE TABLE asistencia (
> empleados_numero INTEGER UNSIGNED NOT NULL,
> semana1 INTEGER UNSIGNED NULL DEFAULT '0',
> ... <same here….. from 2 to 51>
>
> semana52 INTEGER UNSIGNED NULL DEFAULT '0',
> periodo YEAR NULL,
> INDEX asistencia_FKIndex1(empleados_numero),
> FOREIGN KEY(empleados_numero)
> REFERENCES empleados(numero)
> ON DELETE NO ACTION
> ON UPDATE NO ACTION
> );
>
> But thinking about the primary key, this is the only problem (this kind)  I
> have had, and this is the only table that hasn't (own) primary key (only a
> foreign one)
>
> But technically speaking is there something wrong with a table with only
> foreign key?
>
> Must I add "something" just to have a (not foreign) primary key? (Should
> try, I loose nothing)
>
> By the way, a (own) primary key is mandatory IN MOST PARTS or IN ALL PARTS?
>
> Really, thanks a lot.

Yeah. Gambas database component needs a primary key, especially the gb.db.form 
component. By "in most parts" I mean that some method can work without 
primary keys (Exec for example), but Edit() needs it.

To be sure there won't be any problem, use the database manager to create your 
tables.

Regards,

-- 
Benoit Minisini




More information about the User mailing list