Jump to content

Archived

This topic is now archived and is closed to further replies.

Liquid-Fire

Adding and Deleting From MySQL

Recommended Posts

Something I have thought of for the current project I am designing has lead me to this question. Something in my new project to I want to focus on big is user permissions. only thing is that they are going to be changing all the time, not the permissions thought but types of permissions. what i mean by that is the admin let say added a section to the system, I want to have user to be able to have different permission for this section compared to other sections. now I can handle that fine, all I have to do and added more tables for that section for all the permissions. The problem comes when I want to delete a section. If I delete certain MySQL table does the data that was stored in those table for allentries in the table get deleted? can I delete fot the middle of the tbale and will all data for all entries be deleted? I think this is the way is goes but I just want to make sure.

Thank You
Ryan Zec

Share this post


Link to post
Share on other sites
I'm not sure I understand the connection between the deleting and the permissions.

Share this post


Link to post
Share on other sites
basically my question is that when i delete a row, all the information in for that row that was being stored by all the mysql entries for the database will be deleted when the row is delted, is this correct? having a hard time trying to work it hope you understand this way.

Share this post


Link to post
Share on other sites
If you're asking if the related records (by foreign key) will be deleted, that depends on how you've set up your InnoDB constriants. MyISAM tables will not do this.

Share this post


Link to post
Share on other sites
let say i have a database with 3 rows/tables(can't remember which is which right now) called A, B, and C, each of them holding an int value. I create 1 entries for that DB with( call it ONE ):
A = 100
B = 200
C = 300
and 1 more entries with( call it TWO ):
A = 400
B = 500
C = 600
now I edit the DB itself by removing the C row/table(can't remember which is which right now) . where does the data store in the table go? and to be clear i mean where does value 300 for ONE go and where does value 600 for TWO go?

I don't think i can explian much better than this.

Share this post


Link to post
Share on other sites
They should be lost. As they are kept in the hdd. Delete rule for hdd s is loosing the data. There is a recycle bin for win or another os because of the os has written that way. I'm not sure if any db contains such a recycle bin as they are intended to be used by experienced users (for administration and other things). As I said, they should be lost.

Share this post


Link to post
Share on other sites
This is really updating a column value, not adding/deleting records. There's no record of the old value anywhere -- you've changed the value, and that's that. Theoretically, if you have logging enabled, you could track down the original value, but that's a pain in the butt. If you really care, you need to keep your own logging tables, but that's often unnecessary. The real question is why you care -- regular backups can prevent accidental data loss by a stupid user, but some can some good boundary checks in the app itself. Please clarify.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.