Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Newbie : Database commit response error (invalid value for the field 'CountryID')
Mon, May 8 2017 11:26 AMPermanent Link

Peter van Mierlo

EVENTSOFT

hi

My DBISAM table Country contains two fields :
- countryID (autoinc field)
- name (string)

Primary index on the field CountryID

When appending some new values it works, when editing a existing sometimes the
error message appears.

Any suggestions?

Regards Peter
Mon, May 8 2017 11:41 AMPermanent Link

Uli Becker

Peter,

> My DBISAM table Country contains two fields :
> - countryID (autoinc field)
> - name (string)
>
> Primary index on the field CountryID
>
> When appending some new values it works, when editing a existing sometimes the
> error message appears.

Maybe the same issue as described here:

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_beta&page=1&msg=237#237

Uli
Tue, May 9 2017 7:09 AMPermanent Link

Peter van Mierlo

EVENTSOFT

Hi Uli

Well...it seems the same problem. I also use autoinc + primairy index

Did you solve the problem by generate a guid ?

Regards Peter



Uli Becker wrote:

Peter,

> My DBISAM table Country contains two fields :
> - countryID (autoinc field)
> - name (string)
>
> Primary index on the field CountryID
>
> When appending some new values it works, when editing a existing sometimes the
> error message appears.

Maybe the same issue as described here:

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_beta&page=1&msg=237#237

Uli
Tue, May 9 2017 7:36 AMPermanent Link

Uli Becker

Peter,

> Did you solve the problem by generate a guid ?

No, I use integers: on the database side I use a "pool" table that
contains the tablename and the current index number.

With EWB I send a request to a module which executes this function:

CREATE FUNCTION "GetNextID" (IN "FTableName" VARCHAR(100) COLLATE "DEU_CI")
RETURNS INTEGER
BEGIN

   DECLARE FOldID, FNewID INTEGER;

   Execute Immediate 'SELECT NextID INTO ? FROM IDPool WHERE
TableName=?' USING FOldID, FTableName;
   SET FNewID = FOldID + 1;
   Execute Immediate 'UPDATE IDPool SET NextID=? WHERE TableName=?'
USING FNewID, FTableName;

   RETURN FNewID;

END

The request returns the new (unique) ID and I can use this ID to insert
a record.

For the case you want to enter a record manually in your database
manager I use a trigger for each of these tables:

CREATE TRIGGER "InsertID" BEFORE INSERT ON "Info"
BEGIN

   IF NEWROW.ID IS NULL THEN
      SET NEWROW.ID = GetNextID('Info');
   END IF;

END

Uli



Image