![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This one has me stumped: we have a fairly small database (it has only a single table) containing records entered over a couple of years. The records have date-of-creation fields. Can we set permissions such that the records created in every year prior to the current one are read-only? We want users to be able to search the entire database, but only modify this year's records. Thanks in advance to all who respond. |
#3
| |||
| |||
|
|
This one has me stumped: we have a fairly small database (it has only a single table) containing records entered over a couple of years. The records have date-of-creation fields. Can we set permissions such that the records created in every year prior to the current one are read-only? We want users to be able to search the entire database, but only modify this year's records. Thanks in advance to all who respond. |
#4
| |||
| |||
|
|
This one has me stumped: we have a fairly small database (it has only a single table) containing records entered over a couple of years. The records have date-of-creation fields. Can we set permissions such that the records created in every year prior to the current one are read-only? We want users to be able to search the entire database, but only modify this year's records. Thanks in advance to all who respond. |
#5
| |||
| |||
|
|
So in other words, you might be able to keep all data in the same table, dissallow access to the table directly, and instead retrieve data via views that give the needed rights. One view for older data - READ ONLY, and one for newer FULL permissions. |
#6
| |||
| |||
|
|
Duane Phillips wrote: So in other words, you might be able to keep all data in the same table, dissallow access to the table directly, and instead retrieve data via views that give the needed rights. One view for older data - READ ONLY, and one for newer FULL permissions. I admit, I hadn't thought of that approach. I was wondering if I could put a trigger on the table that would check a record's date whenever anyone tried to update it, and prevent the update if the record was older than a given date. But, not having used triggers before, I couldn't figure out the appropriate CREATE TRIGGER command, or even if this approach would work. Why not use archive tables, they can only do inserts and selects and are |
#7
| |||
| |||
|
|
Duane Phillips wrote: So in other words, you might be able to keep all data in the same table, dissallow access to the table directly, and instead retrieve data via views that give the needed rights. One view for older data - READ ONLY, and one for newer FULL permissions. I admit, I hadn't thought of that approach. I was wondering if I could put a trigger on the table that would check a record's date whenever anyone tried to update it, and prevent the update if the record was older than a given date. But, not having used triggers before, I couldn't figure out the appropriate CREATE TRIGGER command, or even if this approach would work. |
#8
| |||
| |||
|
|
Leslie Houk wrote: Duane Phillips wrote: So in other words, you might be able to keep all data in the same table, dissallow access to the table directly, and instead retrieve data via views that give the needed rights. One view for older data - READ ONLY, and one for newer FULL permissions. I admit, I hadn't thought of that approach. I was wondering if I could put a trigger on the table that would check a record's date whenever anyone tried to update it, and prevent the update if the record was older than a given date. But, not having used triggers before, I couldn't figure out the appropriate CREATE TRIGGER command, or even if this approach would work. Why not use archive tables, they can only do inserts and selects and are compressed. |
#9
| |||
| |||
|
|
You can use Stored Procedures for your updates and writes, and have those test the date or cancel the update. Leave the table read only except via SPs. |
#10
| |||
| |||
|
|
Duane Phillips wrote: You can use Stored Procedures for your updates and writes, and have those test the date or cancel the update. Leave the table read only except via SPs. I think that will be the best approach, but my lack of mySQL knowledge is hurting me. I did some reading in the MySQL 5.1 Reference Manual on dev.mysql.com, and given that I have the table ITPLAN.REQUESTS with the DATE field "init_date", I'm thinking I would do something like: CREATE TRIGGER FY2007 BEFORE UPDATE ON ITPLAN.REQUESTS IF "update request's init_date value" < '2006-09-01' THEN "ignore update request" but I don't know what to put for "update request's init_date value" or "ignore update request". (I think "update request's init_date value" might be just "NEW.init_date", but I'm not sure about that.) I tried looking it up in the MySQL 5.1 Reference Manual, but I couldn't find the appropriate section. Any guidance would be humbly appreciated. Leslie |
![]() |
| Thread Tools | |
| Display Modes | |
| |