mysql - Are Prepared Statements a waste for normal queries? (PHP) -
Nowadays, "ready statement" recommends sending questions for a database in the same way. I also look at the recommendations for using ready-made statements for stored procs. However, additional query-ready statements are required - and in a short time - I have been explained that they have a line of INSERT / UPDATE queries Only useful are I
I hope someone can improve me on this, but it seems like a repetition of the completely "tables evil" CSS cheese Tables are only evil The used for layouts - tabular data. The use of a divisor for a composite data is a violation of WC3.
Like intelligent, simple SQL (or generated by AR) proves useful for more than 80% of queries, which are mostly sites, a single selection does not repeat that page load again. Going (I'm talking about scripting languages like PHP) Why can I make my over-taxed DB that a statement should be prepared that it can be run once before removing it?
MySQL:
A ready statement is specific to the session in which it was created if you terminate a session without deleting the previously prepared statement , The server automatically delinks itself.
This will automatically close the PHP connection at the end of your script and you will lose the ready statement
Am I missing something or would it reduce the performance Is there just one way?
: Update:
It seemed to me that I am assuming new connections for each script. I would have thought that if a continuous connection is used then these problems will disappear. Is it true?
: UPDATE2:
It seems that if there are persistent connection solutions - they are mostly for the web - especially if you use the transaction, so I will come back to square I have nothing more than the benchmark below ...
: UPDATE3:
Most people only repeat the phrase "the statement made in SQL injection" which is full of problems The "Escape" method available for each DB library is not understood by the way Saves even the SQL injection but it is more than that:
When a query sends in a normal way, the client (script) Converts data to strings which are then sent to the DB server. DB servers then use change them back by using CAP power in appropriate binary datatype. The database engine then parses the statement and looks for syntax errors.
When using Ready Statement ... data is sent in an original binary form, which protects conversion-CPU usage, and makes data more efficient move Clearly, it uses bandwidth Will also reduce if the client is not co-located with the DB server.
... variable types are predefined, and therefore MySQL takes these characters into account, and it needs to be saved.
After all, thanks for the OIS to straighten me on this issue.
If you use the prepared statement as the only way to be provided by the user, then "post-text" itemprop = "text">
data in a query, then These are completely bullet proof when it comes to SQL injection.
Comments
Post a Comment