#include <item_func.h>
◆ user_var_entry()
  
  
      
        
          | user_var_entry::user_var_entry  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
default   | 
  
 
 
◆ alloced()
  
  
      
        
          | bool user_var_entry::alloced  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineprivate   | 
  
 
Check if m_ptr points to an external buffer previously allocated by realloc(). 
- Return values
 - 
  
    | true | - an external buffer is allocated.  | 
    | false | - m_ptr is null, or points to the internal buffer.  | 
  
   
 
 
◆ assert_locked()
  
  
      
        
          | void user_var_entry::assert_locked  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
private   | 
  
 
Assert the user variable is locked. 
This is debug code only. The thread LOCK_thd_data mutex protects:
- the thd->user_vars hash itself
 
- the values in the user variable itself. The protection is required for monitoring, as a different thread can inspect this session user variables, on a live session. 
 
 
 
◆ copy_name()
Copy the array of characters from the given name into the internal name buffer and initialize entry_name to point to it. 
 
 
◆ create()
Allocates and initializes a user variable instance. 
- Parameters
 - 
  
    | thd | Current session.  | 
    | name | Name of the variable.  | 
    | cs | Charset of the variable. | 
  
   
- Returns
 - Address of the allocated and initialized user_var_entry instance. 
 
- Return values
 - 
  
  
 
 
 
◆ destroy()
  
  
      
        
          | void user_var_entry::destroy  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Free all memory used by a user_var_entry instance previously created by create(). 
 
 
◆ free_value()
  
  
      
        
          | void user_var_entry::free_value  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineprivate   | 
  
 
Free the external value buffer, if it's allocated. 
 
 
◆ init()
Initialize all members. 
- Parameters
 - 
  
    | thd | Current session.  | 
    | name | Name of the user_var_entry instance.  | 
    | cs | charset information of the user_var_entry instance.  | 
  
   
 
 
◆ internal_buffer_ptr()
  
  
      
        
          | char * user_var_entry::internal_buffer_ptr  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineprivate   | 
  
 
Position inside a user_var_entry where small values are stored: double values, longlong values and string values with length up to extra_size (should be 8 bytes on all platforms). 
String values with length longer than 8 are stored in a separate memory buffer, which is allocated when needed using the method realloc(). 
 
 
◆ length()
  
  
      
        
          | size_t user_var_entry::length  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ lock()
      
        
          | void user_var_entry::lock  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ mem_realloc()
  
  
      
        
          | bool user_var_entry::mem_realloc  | 
          ( | 
          size_t  | 
          length | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Initialize m_ptr to the internal buffer (if the value is small enough), or allocate a separate buffer. 
- Parameters
 - 
  
    | length | - length of the value to be stored.  | 
  
   
 
 
◆ name_ptr()
  
  
      
        
          | char * user_var_entry::name_ptr  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineprivate   | 
  
 
Position inside a user_var_entry where a null-terminates array of characters representing the variable name is stored. 
 
 
◆ owner_session()
  
  
      
        
          | THD * user_var_entry::owner_session  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ ptr()
  
  
      
        
          | const char * user_var_entry::ptr  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ reset_value()
  
  
      
        
          | void user_var_entry::reset_value  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineprivate   | 
  
 
 
◆ set_null_value()
  
  
      
        
          | void user_var_entry::set_null_value  | 
          ( | 
          Item_result  | 
          type | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Set value to NULL. 
- Parameters
 - 
  
  
 
 
 
◆ set_type()
Set type of to the given value. 
- Parameters
 - 
  
  
 
 
 
◆ set_used_query_id()
  
  
      
        
          | void user_var_entry::set_used_query_id  | 
          ( | 
          query_id_t  | 
          query_id | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ set_value()
  
  
      
        
          | void user_var_entry::set_value  | 
          ( | 
          char *  | 
          value,  | 
         
        
           | 
           | 
          size_t  | 
          length  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlineprivate   | 
  
 
 
◆ store() [1/2]
  
  
      
        
          | bool user_var_entry::store  | 
          ( | 
          const void *  | 
          from,  | 
         
        
           | 
           | 
          size_t  | 
          length,  | 
         
        
           | 
           | 
          Item_result  | 
          type  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Store a value of the given type into a user_var_entry instance. 
- Parameters
 - 
  
    | from | Value  | 
    | length | Size of the value  | 
    | type | type  | 
  
   
- Return values
 - 
  
    | false | on success  | 
    | true | on memory allocation error  | 
  
   
 
 
◆ store() [2/2]
Set value to user variable. 
- Parameters
 - 
  
    | ptr | pointer to buffer with new value  | 
    | length | length of new value  | 
    | type | type of new value  | 
    | cs | charset info for new value  | 
    | dv | derivation for new value  | 
    | unsigned_arg | indicates if a value of type INT_RESULT is unsigned | 
  
   
- Note
 - Sets error and fatal error if allocation fails.
 
- Return values
 - 
  
  
 
 
 
◆ type()
◆ unlock()
      
        
          | void user_var_entry::unlock  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ used_query_id()
  
  
      
        
          | query_id_t user_var_entry::used_query_id  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ val_decimal()
Get the value of a variable as a decimal. 
 
 
◆ val_int()
      
        
          | longlong user_var_entry::val_int  | 
          ( | 
          bool *  | 
          null_value | ) | 
           const | 
        
      
 
Get the value of a variable as an integer. 
 
 
◆ val_real()
      
        
          | double user_var_entry::val_real  | 
          ( | 
          bool *  | 
          null_value | ) | 
           const | 
        
      
 
Get the value of a variable as a double. 
 
 
◆ val_str()
      
        
          | String * user_var_entry::val_str  | 
          ( | 
          bool *  | 
          null_value,  | 
        
        
           | 
           | 
          String *  | 
          str,  | 
        
        
           | 
           | 
          uint  | 
          decimals  | 
        
        
           | 
          ) | 
           |  const | 
        
      
 
Get the value of a variable as a string. 
 
 
◆ collation
◆ entry_name
◆ extra_size
  
  
      
        
          | const size_t user_var_entry::extra_size = sizeof(double) | 
         
       
   | 
  
staticprivate   | 
  
 
 
◆ m_length
  
  
      
        
          | size_t user_var_entry::m_length | 
         
       
   | 
  
private   | 
  
 
 
◆ m_owner
  
  
      
        
          | THD* user_var_entry::m_owner | 
         
       
   | 
  
private   | 
  
 
 
◆ m_ptr
  
  
      
        
          | char* user_var_entry::m_ptr | 
         
       
   | 
  
private   | 
  
 
 
◆ m_type
◆ m_used_query_id
Set to the id of the most recent query that has used the variable. 
Used in binlogging: When set, there is no need to add a reference to this variable to the binlog. Imagine it is this: 
INSERT INTO t SELECT @a:=10, @a:=@a+1.
 Then we have a Item_func_get_user_var (because of the @a+1) so we think we have to write the value of @a to the binlog. But before that, we have a Item_func_set_user_var to create @a (@a:=10), in this we mark the variable as "already logged" so that it won't be logged by Item_func_get_user_var (because that's not necessary). 
 
 
◆ unsigned_flag
      
        
          | bool user_var_entry::unsigned_flag | 
        
      
 
 
The documentation for this class was generated from the following files: