U
U
Urukhayy2015-11-07 14:41:40
MySQL
Urukhayy, 2015-11-07 14:41:40

Is it recommended to dedicate an entire method/function for formatting and preparing a MySQL query?

Suppose there is a method in which the result of completed forms is processed. After all, it would be incorrect to make a request inside the block for processing the entered data?
But if you create a method, then you need to pass the result of the forms to it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2015-11-07
@Urukhayy

That part of the code that works with the database should be connected with the rest of the code only by the set of data that it needs to save or read.
The application logic should not know anything about tables, queries, and so on. It only needs to know how to access the database wrapper to get or store data.
Any mixture of these two levels leads to shitcode - this has already been verified by several generations of pykhers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question