409
409
LEX *lex; /**< parse tree descriptor */
411
Points to the query associated with this statement. It's const, but
412
we need to declare it char * because all table handlers are written
413
in C and need to point to it.
415
Note that (A) if we set query = NULL, we must at the same time set
416
query_length = 0, and protect the whole operation with the
417
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
418
non-NULL value if its previous value is NULL. We do not need to protect
419
operation (B) with any mutex. To avoid crashes in races, if we do not
420
know that session->query cannot change at the moment, one should print
421
session->query like this:
422
(1) reserve the LOCK_thread_count mutex;
423
(2) check if session->query is NULL;
424
(3) if not NULL, then print at most session->query_length characters from
425
it. We will see the query_length field as either 0, or the right value
427
Assuming that the write and read of an n-bit memory field in an n-bit
428
computer is atomic, we can avoid races in the above way.
429
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
433
uint32_t query_length; /**< current query length */
410
/** query associated with this statement */
436
414
Name of the current (default) database.