Juan

  A couple of problems I see with that is you will have to reload (or pack) 
your database more often and it makes it difficult to use in a multi user 
environment. 

 

  What I would do is use the temp table and then create an EEP (when exiting 
row). This EEP would check “FK” against the “PK”. Granted you would have to 
write a few more lines of code for the EEP but I believe it would be safe for 
multi users.

 

Buddy

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Juan Otazú
Sent: Friday, February 15, 2013 6:58 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table

 

Yes, I am doing it with the same name.

 

Thanks to all ! 

Regards

Juan Otazú

 

From: [email protected] [mailto:[email protected]] On Behalf Of Bruce Chitiea
Sent: jueves, 14 de febrero de 2013 07:04 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table

 

Señor:

 

Why not then create a permanent table with the desired keys when needed, and 
then either:

 

a) drop the table after, or

 

b) delete all rows and preserve for next use.

 

While this might require more frequent PACKing, might this work for you?

 

Bruce Chitiea

SafeSectors, Inc.

-------- Original Message --------
Subject: [RBASE-L] - Re: Create FK in temporary table
From: Juan_Otazú < <mailto:[email protected]> [email protected]>
Date: Thu, February 14, 2013 1:01 pm
To:  <mailto:[email protected]> [email protected] (RBASE-L Mailing List)

I am using 9.5 (32).. I think the same.

 

An opportunity to improve, because temporary table is very usefully to enter 
data using a form.

 

Thanks.

Juan

 

 

From:  <mailto:[email protected]> [email protected] [ 
<mailto:[email protected]> mailto:[email protected]] On Behalf Of Karen Tellef
Sent: jueves, 14 de febrero de 2013 04:54 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table

 

You don't mention what version you're using.  I just fired up 9.5 and created a 
temp
table and then an FK on it and I got an error.  I fired up an old copy of 6.5 
and it doesn't
work there either, so I assume this has never worked.

Karen

 

 

 

-----Original Message-----
From: Juan Otazú < <mailto:[email protected]> [email protected]>
To: RBASE-L Mailing List < <mailto:[email protected]> [email protected]>
Sent: Thu, Feb 14, 2013 1:42 pm
Subject: [RBASE-L] - Re: Create FK in temporary table

Thanks Karen, first I tried this process, the same error.

 

CREATE TEMPORARY TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL+

       ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT NULL  +

       ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL   +

       ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40,         +

       artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior)         +

       ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), CHECK (material_actual <>  +

       material_anterior))

 

ALTER TABLE tdexpara_cambios ADD FOREIGN KEY (material_actual) REFERENCES      +

      sap_material

 

All the PK and Rules definition works in temporary table except the FK. (At 
least for me).

 

This could be a issue?

 

Thanks

Juan

 

From:  <mailto:[email protected]> [email protected] [ 
<mailto:[email protected]?> mailto:[email protected]] On Behalf Of Karen Tellef
Sent: jueves, 14 de febrero de 2013 04:14 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table

 

I've never tried to create a FK on a temp table so can't tell you if that works
or not.  But you can create the temp table first and then use the alter command
to add the FK afterwards.  See if that works.  Here's an example:

ALTER TABLE mpsinvoice ADD FOREIGN KEY (vendornum) REFERENCES vendors


Karen

 

 

 

-----Original Message-----
From: Juan Otazú < <mailto:[email protected]> [email protected]>
To: RBASE-L Mailing List < <mailto:[email protected]> [email protected]>
Sent: Thu, Feb 14, 2013 1:05 pm
Subject: [RBASE-L] - Create FK in temporary table

Hi to all,
 
I need to create a temporary table to enter data into a form and validate
some PK, FK rules.
 
This command work fine:
CREATE TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL
+
       ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT
NULL  +
       ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL
+
       ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40,
+
       artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior)
+
       ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), FOREIGN KEY
+
       (material_anterior) REFERENCES sap_material
+
       ('MATERIAL ANTERIOR NO EXISTE EN SAP'), FOREIGN KEY (material_actual)
+
       REFERENCES sap_material ('MATERIAL ACTUAL NO EXISTE EN SAP'), CHECK
+
       (material_actual <> material_anterior))
It is a regular table.
 
But this do not work:
CREATE TEMPORARY TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT
NULL+
       ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT
NULL  +
       ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL
+
       ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40,
+
       artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior)
+
       ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), FOREIGN KEY
+
       (material_anterior) REFERENCES sap_material
+
       ('MATERIAL ANTERIOR NO EXISTE EN SAP'), FOREIGN KEY (material_actual)
+
       REFERENCES sap_material ('MATERIAL ACTUAL NO EXISTE EN SAP'), CHECK
+
       (material_actual <> material_anterior))
 
The message say: -ERROR- The referenced table does not exist. (2801)
Do not create the temporary table.
 
The only one change has been add "temporary" to line 1.
 
Some issues to connect temporary FK to regular PK ?
 
Thanks in advance.
R:egards
Juan Otazú
R:Base 9.5 (32)
 
 

Reply via email to