Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide_node error #16

Open
tstkenny opened this issue Feb 18, 2019 · 3 comments
Open

hide_node error #16

tstkenny opened this issue Feb 18, 2019 · 3 comments

Comments

@tstkenny
Copy link

This is the best closure repo so far! However, I am unable to get the hide node procedure working:

Steps to reproduce:

  1. run the mysql.sql provided in this repo
  2. invoke p_node_hide(12,1) and it throws error: Can't update table 'prefix_nodes' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
  3. invoke p_node_hide(12,0) and it returns success!

Anyone can lend me a hand please? I really need these procedures badly. Thank you!

@infinite-system
Copy link

it will not work, because MySQL cannot update same table rows in a trigger,
it can only update that specific row that is being updated, but the other rows in that table are locked from editing, the way i solved it, is to put the hidden field into a closure table instead, and put a hidden parameter there where the ancestor_id = descendant_id as that row refers to itself and then get the hidden parameter via a join.

Yes, this is a best mysql example to start off, but it's not perfect.

I redesigned this completely and have a working closure table that can be ordered by custom OrderIndex, Added date or by Alphabet.

Thanks to the creator of this repo as it helped me, but my final design has deviated a lot from this to make it work on production level.

@tstkenny
Copy link
Author

@masterm1nd any chance you can share your repo for us? I have been struggling with this for weeks but no luck. If you do I am sure you are giving a big hand to all of us!

@infinite-system
Copy link

I am busy with a project right now for which I built this for, but I will think about it.

It took me 23 days full time to solve this.
I am hesitating a bit to release it freely, even though i realize it's the best out there now and can help people.

But I can definitely sell it for a fee if you really want it bad, and later i will think about releasing it publicly.

You can email me to ekalashnikov at gmail com, if you are interested, or I can give you more tips if you want to build it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants