Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of the problem of SQL permission setting

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "SQL permission setting problem case analysis", the article explains the content is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "SQL permission setting problem case analysis" bar!

The first is the operation rights of a user, nothing more than these four aspects, additions, deletions, changes and searches.

If it is identified by letters, it may be added (I) deleted (D) changed (U) looked up (S)

Then the permissions of a user or table may have a combination like IS,IDUS,IDU, which will disrupt our existing way, because the combination of four elements, taking into account the order, there are actually many, such as 2 consecutive, 3 consecutive, different order.

So if you use a field to verify the difference, in the form of characters, it is still very difficult and easy to make mistakes, such as ISU and SUI all represent the same meaning, but there are many ways to combine them.

Or another way of thinking, if I use four fields to distinguish between checks, which are additions, deletions, changes and queries, the problem seems to be easily solved. in fact, we need to make a large number of combinations between the four fields, and the sentence may be very verbose. Some students want to use a form similar to in ('select','insert','delete','update') to check, but obviously, this method can not locate the boundary, such as select+insert+update and select+insert+update+delete in the above case will return the result normally.

So can you use a field to mark this question? I thought of one.

For example, adding, deleting, changing and searching, according to the weight, it should actually be the weight of select,insert,update,delete. If we set it as 1Magne2, 3, and 4, it is easy to be confused, for example, 4, which may be a combination of 1, 2, 3, 4, so it is difficult to judge which permissions we have.

So we need to treat it differently and borrow the RMB way of thinking. We know that there are 1 yuan and 2 yuan in RMB. Five yuan, ten yuan. So it would be much better for us to combine it in this way, with a weight value of:

Select (1)

Insert (2)

Update (5)

Delete (10)

But in fact, permissions are combined in the business, and there are several combinations as follows.

such as

Select

Insert+select

Delete+select

Update+select

Select+insert+update

Select+insert+update+delete

In fact, this is the combination, according to the weight combination is:

Select 1

Insert+select 3

Delete+select 11

Update+select 6

Select+insert+update 8

Select+insert+update+delete 18

So when we get a number, we know its exact authority, and it's easy to deal with it.

Thank you for your reading, the above is the content of "case Analysis of the problem of SQL permission setting". After the study of this article, I believe you have a deeper understanding of the case analysis of the problem of SQL permission setting, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report