user1386320
user1386320

Reputation:

Locking records in MySQL Database

Is it possible to lock a particular record in a MySQL Table?

I have this structure for table "categories" which has an Internal Relation with "id" of that same table (for nested and parent-child categories):

CREATE TABLE `dokumenti`.`categories` (
`id` INT( 9 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`categoryId` INT( 9 ) UNSIGNED NOT NULL,
`title` VARCHAR( 128 ) NOT NULL ,
`description` TEXT NULL DEFAULT NULL ,
INDEX ( `categoryId` )
) ENGINE = InnoDB;

categoryId by default can be 0 or NULL value.

Is it possible to insert a record like this:

INSERT INTO categories VALUES(0, 0, 'Root Level Category', 'Root Level Category')

And to lock it so it cannot be DELETED, UPDATED or ALTERED?

Upvotes: 0

Views: 239

Answers (1)

Syneo
Syneo

Reputation: 61

If you need a permanent "lock", you can have a look to the "Archive" engine

Upvotes: 1

Related Questions