Jump to content


Photo

Adding and Deleting From MySQL


  • Please log in to reply
6 replies to this topic

#1 Liquid-Fire

Liquid-Fire
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 03 June 2006 - 01:38 PM

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

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 June 2006 - 04:35 PM

I'm not sure I understand the connection between the deleting and the permissions.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 Liquid-Fire

Liquid-Fire
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 03 June 2006 - 05:46 PM

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.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 June 2006 - 10:40 PM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 Liquid-Fire

Liquid-Fire
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 08 June 2006 - 01:26 AM

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.

#6 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 08 June 2006 - 08:56 AM

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.
Roy Simkes
Yet Another Parkyeri Developer

#7 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 09 June 2006 - 06:07 AM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users