Is it best practice for a database that allows applications to perform CRUD operations always through SP?

I heard reasoning about it, and I was curious if others think of it as a best practice / good idea.

One of the reasons is that limiting restrictions on direct access to database tables and forcing applications / users to use SP (stored procedures) to perform CRUD operations will allow database administrators

  • fine-grained control to approve / review SP before moving them into production
  • avoid random requests written by developers that may cause problems with loading the server / other servers.

This means that the developer cannot write Linq queries to tables (although Linq queries involving SP are possible). It also means that the developer must forget about compile-time checks and also have full control over the data, and primarily use a different language (SQL) to work with data.

I do not mind this, and I do not think this is a great idea. I'm just curious to know what others think. What are the other advantages and disadvantages of this approach.

Update . As mentioned by Thomas in his answer , I tend to think that SPs are logical and use "database programming in SQL," making the logic in order, if not "business logic." Business logic requires separation, compile-time verification and integration checkpoints and what not.

+3
12

. , -.

, . , - , , .

, , , . , , , , . Whining , ...

  • , - . - , .
  • . , procs, , A , B.
  • - SP, , . , , SP, . , - , - , , , .
+4

"R" CRUD. . procs , ... .

+7

, .

,

  • - , .
  • PDM - PDM , "" (SPs, Views), .
  • Futureproofing - , , , .

, .

, , ORM.

+3

procs ( , SQL) , , , , dba. , .

+3

.

, SPROC: .

, , LINQ. . (, , LINQ, , SPROC, .)

+1

:

, Linq . , , , . (SQL Linq) .

, .

+1

, Oracle.

Oracle SQL/PLSQL.

, CRUD :

  • , .
    • .
    • DML :
      • , //, TEMP
    • , :
      • , BEFORE I/U/D
        • MERGE 'd
        • , AFTER I/U/D

, foreign key - .

.

, , .

.

UPDATE, , 50,000 10,000,000, 10 200 .


, , .

, , .

+1

, .

, , CRUD . , , , . , - . , , , , , , , . . , , . -, - .

, . .

, ( , , , ).

, , . , , CRUD , , , , .

+1

, .

, , .

, crap sql, , , .

SQL ( ) : .

db .

, , .

, , , . , , PDF - , , - ?

.

, ( )...

0

- , SP , , SQL . SP . SQL, , , .

, , , , SP, SQL.

0

- , -, MUD SW...

Separate logic and data. SPs are logical ...!

Evil languages ​​(it's me) claim that SP is the methods of database providers for creating locking technologies, which will make it difficult to create abstractions, which will simplify changing the database provider ...

SPs are in 99.9% of their use of the ANTI-design template ...!

0
source

Source: https://habr.com/ru/post/1703140/


All Articles