S
S
Sergey Savostin2016-08-04 11:28:34
MySQL
Sergey Savostin, 2016-08-04 11:28:34

Criticize the approach?

There is an idea to create a web application, no matter what, where all the logic of working with data (API, Restful, CRUD) will not be taken out of the database. Those. we leave all the business logic inside the database, we write it on innoDB triggers, SQL procedures and SQL functions. PHP (let's say) doesn't do any SELECT/INSERT/UPDATE/DELETE, but only calls procedures like METHOD_acion(params).
For example, GET_some(id);
From the pros I see:

  1. Data and logic in one place
  2. PHP can be easily replaced with anything, up to the nginx module in C
  3. Versioning, code + data integrity is easier (?) to control
  4. Backup with one dump

Of the minuses:
  1. Как работать со "сложными" данными/параметрами, в частности с JSON? Есть ли какой-то "универсальный" формат передачи иерархических данных PHP <-> MySQL? На случай, если понадобится отдать xml, например.
  2. К предыдущему пункту: валидация входных данных - как?
  3. Как все-таки сделать версионность?
  4. Отладка кода - мрак еще тот.
  5. Удобства почти ноль - ни фреймворков, ни библиотек - все ручками.

Кто-то таким извращением занимался? Отговорите меня ;)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
lega, 2016-08-04
@savostin

I debugged one such project of one large (forbes top 40) company, it still sucks, it slowed down like crazy, stored procedures in 10k lines.
- Well, it's convenient to develop
- The language is not for application development (if it is * SQL)
- It will slow down more, because the entire load goes to one link, when in high-load projects they try, on the contrary, to unload the central links.

Y
Yustas Alexu, 2016-08-04
@Yuxus

Возможна такая ситуация: где-то что-то поменял и все рухнуло. А где и что поменял, не помню.

D
Dmitry BPW, 2016-08-05
@Dmitry_BPW

I support Night. It's very difficult to test things like this. And without proper testing, you will not get a quality product. Alternatively, you can leave the idea, but soften it a little. That is, to take out of the database at least part of the planned. Then it’s easier to test, and there are fewer brakes too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question