Links

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Aug 20 20:39:14 CDT 2015


In addition to my previous e-mail, a few more questions.

I have two tables. table1 and table2. Table1 is a very big table and 
table2 is a very small table, considering the number of fields. Both 
tables contain field key1. In table1, key1 is set as the primary key. 
Table2 doesn't have a primary key, but key1 could be set as its primary 
key, although I have another candidate for the primary key.

The two tables are linked as follows:

SET PROPERTY "last_related" OF TABLE "table2" TO 'table1: 
Link_table1_table2 (M:1)';

I now try to insert data into the small table2 with a query like

INSERT INTO table2 (field1, field2, key1, field4)
   VALUES ('data 1','data 2','0001','data 4')

Table1 already has record with 0001 in field key1, but table2 doesn't 
have such a record. If I run my query, I always get error 0x23502, 
ERR_CONSTRAINT_FOREIGN_KEY_VIOLATION.

What is the explanation for this error?
Did I set the property incorrectly, e.g. should I use 1:M instead of 
M:1? If so, why?

Since no other database system uses this type of links (according to the 
docs), is it really a good idea to use this type of links? Should I just 
not link table2? What kind of queries does the link make possible, which 
otherwise wouldn't be possible?

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/



On 8/21/2015 03:19, Mark Schonewille wrote:
> Hi,
>
> I can find in the documentation how to create links, but I can't find
> the answers to my questions.
>
> How exactly do links work?
> What do 1:M and M:M mean?
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Installer Maker for LiveCode:
> http://qery.us/468
>
> Buy my new book "Programming LiveCode for the Real Beginner"
> http://qery.us/3fi
>
> LiveCode on Facebook:
> https://www.facebook.com/groups/runrev/
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>


More information about the Valentina mailing list