~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/get_user_var.cc

  • Committer: Stewart Smith
  • Date: 2011-01-14 05:18:23 UTC
  • mto: (2086.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: stewart@flamingspork.com-20110114051823-14fyn2kvg8pc5a15
\r and trailing whitespace removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
47
47
}
48
48
 
49
49
 
50
 
my_decimal *Item_func_get_user_var::val_decimal(my_decimal *dec)
 
50
type::Decimal *Item_func_get_user_var::val_decimal(type::Decimal *dec)
51
51
{
52
52
  assert(fixed == 1);
53
53
  if (!var_entry)
65
65
 
66
66
void Item_func_get_user_var::fix_length_and_dec()
67
67
{
68
 
  Session *session=current_session;
69
68
  maybe_null=1;
70
69
  decimals=NOT_FIXED_DEC;
71
70
  max_length=MAX_BLOB_WIDTH;
72
71
 
73
 
  var_entry= session->getVariable(name, false);
 
72
  var_entry= session.getVariable(name, false);
74
73
 
75
74
  /*
76
75
    If the variable didn't exist it has been created as a STRING-type.
89
88
    case REAL_RESULT:
90
89
      max_length= DBL_DIG + 8;
91
90
      break;
 
91
 
92
92
    case INT_RESULT:
93
93
      max_length= MAX_BIGINT_WIDTH;
94
94
      decimals=0;
96
96
    case STRING_RESULT:
97
97
      max_length= MAX_BLOB_WIDTH;
98
98
      break;
 
99
 
99
100
    case DECIMAL_RESULT:
100
101
      max_length= DECIMAL_MAX_STR_LENGTH;
101
102
      decimals= DECIMAL_MAX_SCALE;
102
103
      break;
 
104
 
103
105
    case ROW_RESULT:                            // Keep compiler happy
104
 
    default:
105
106
      assert(0);
106
107
      break;
107
108
    }
118
119
 
119
120
bool Item_func_get_user_var::const_item() const
120
121
{
121
 
  return (!var_entry || current_session->getQueryId() != var_entry->update_query_id);
 
122
  return (!var_entry || session.getQueryId() != var_entry->update_query_id);
122
123
}
123
124
 
124
125