Why does my query depend on a nameset query?

i connect to mysql server and execute the request. the query returns the result when I query the set names before or after the main query, otherwise it returns a null result. why is that so?

+3
source share
2 answers

it sounds like you have special characters in your query that will cause problems if you don't set the correct encoding, which should be used to send the SQL query to the server. if you do not run "set names", the default value is used - and this seems wrong.

for more information, see the documentation

+1
source

Quote from the MySQL manual:

SET NAMES , SQL

, , , ​​ MySQL . charset utf8, .

: http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html

+1

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


All Articles