[Gambas-devel] CTable.c primary key query
Benoit Minisini
gambas at ...1...
Wed Feb 25 20:12:28 CET 2004
On Wednesday 25 February 2004 19:02, Nigel Gerrard wrote:
> Benoit,
>
> If you create a table outside of the gambas-database-manager and you do not
> create a primary key,you cannot go into the gdm and then create a primary
> key afterwards unless line 548 of CTable.c (CTable_update) is changed from:
>
> if (!This->primary || GB.Count(THIS->primary) ==0)
>
> to
>
> if (!This->primary)
>
> I know there seems little logic in this...but it does work and I do believe
> that tables created outside gambas should still be accessible. What do you
> think?
Are you sure ? Because this test prevents for creating a table WITHOUT any
primary keys. It can't prevent a table for being accessible... Maybe the
problem is in the GDM, isn't it ?
>
> Also in CResult.c from line 468, I would suggest checking that there is a
> key for the "WHERE" clause to use. e.g:
>
> if (!THIS->edit)
> {
> GB.Error("No key for Update");
> }
> else {
> q_add(THIS->edit);
> THIS->driver->Exec(THIS->db->handle, q_get(), NULL, "Cannot modify
> record: &1"); }
>
> break;
>
> This is because the message provided from doing a failed query syntax is
> not neccessarily very clear.
But the problem is that Connection.Edit/Result.Update can't work without an
index! So it is DB.Edit that should raise an error if it don't find an index
in the table.
What do you think ?
--
Benoit Minisini
mailto:gambas at ...1...
More information about the Devel
mailing list