Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Foreign Keys Integrity - Please explain? 27 Mar 2012 04:12 #1733

  • edwardcox
  • edwardcox's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Here to help.
  • Posts: 131
  • Thank you received: 26
Hello All,

Could someone please explain to me what the settings in the Foreign Key Integrity are:
  • none
  • reset
  • cascade

That might help me better understand what I am doing when using a FK.

Kind Regards,

Edward
Passionate Joomla! Developer and J-Cook pro evangelist.
www.jcombuilder.com - we build great Joomla!® Components so you don't have to.

Please Log in or Create an account to join the conversation.

Re: Foreign Keys Integrity - Please explain? 28 Mar 2012 04:41 #1750

Hi Edward,

I think the explanation under the question mark in the builder is already clear:
None : Keep object with his broken key.
Reset : set to 0.
Cascade : delete all objects from this table that refers to it.

An example with two tables:
TableA
TableB: Foreign key TableA_id.

If you delete in TableA a record with TableA_id value 1 the process is:
None:
Records in TableB keeps there reference to TableA_id 1. A result could be that views will not work or at least misses data from TableA because the record does not exist anymore.

Reset:
Records in TableB with TableA_id value 1 will be reset to 0. Same result as above but it is easier to capture the 'wrong' records.

Cascade:
Records in TableB with TableA_id value 1 will be deleted. Dangerous because all records with the TableA_id reference will be deleted in TableB. Important to build in a warning or an extra confirmation of the user.

Hope this will help you.

Best Regards,
Adriaan
Molenwal1 Webdesign
www.molenwal1.nl
The following user(s) said Thank You: admin, griiettner, VeCrea, edwardcox

Please Log in or Create an account to join the conversation.

Re: Foreign Keys Integrity - Please explain? 28 Mar 2012 04:47 #1751

  • edwardcox
  • edwardcox's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Here to help.
  • Posts: 131
  • Thank you received: 26
Big Thanks Adriaan,

Damn that elusive Question Mark help symbol I keep forgetting about.
Your explanation is clear and concise. Much appreciated.

Regards,

Edward
Passionate Joomla! Developer and J-Cook pro evangelist.
www.jcombuilder.com - we build great Joomla!® Components so you don't have to.

Please Log in or Create an account to join the conversation.

Re: Foreign Keys Integrity - Please explain? 30 Mar 2012 07:46 #1789

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
And for the moment, Cook don't ask you anything before to process. It is only an automatism when you are sure of what you do. If not, don't allow final user to delete.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.061 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started