~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/get_user_var.cc

  • Committer: Eric Day
  • Date: 2009-11-10 21:50:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1218.
  • Revision ID: eday@oddments.org-20091110215022-0b2nqmurv7b2l6wo
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
22
 
#include <float.h>
23
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
24
22
#include <drizzled/function/get_user_var.h>
25
23
#include <drizzled/item/null.h>
26
24
#include <drizzled/sql_parse.h>
27
25
#include <drizzled/session.h>
28
26
 
29
 
namespace drizzled
30
 
{
31
 
 
32
 
String *Item_func_get_user_var::val_str(String *str)
 
27
String *
 
28
Item_func_get_user_var::val_str(String *str)
33
29
{
34
30
  assert(fixed == 1);
35
31
  if (!var_entry)
65
61
 
66
62
void Item_func_get_user_var::fix_length_and_dec()
67
63
{
 
64
  Session *session=current_session;
68
65
  maybe_null=1;
69
66
  decimals=NOT_FIXED_DEC;
70
67
  max_length=MAX_BLOB_WIDTH;
71
68
 
72
 
  var_entry= session.getVariable(name, false);
 
69
  var_entry= session->getVariable(name, false);
73
70
 
74
71
  /*
75
72
    If the variable didn't exist it has been created as a STRING-type.
88
85
    case REAL_RESULT:
89
86
      max_length= DBL_DIG + 8;
90
87
      break;
91
 
 
92
88
    case INT_RESULT:
93
89
      max_length= MAX_BIGINT_WIDTH;
94
90
      decimals=0;
96
92
    case STRING_RESULT:
97
93
      max_length= MAX_BLOB_WIDTH;
98
94
      break;
99
 
 
100
95
    case DECIMAL_RESULT:
101
96
      max_length= DECIMAL_MAX_STR_LENGTH;
102
97
      decimals= DECIMAL_MAX_SCALE;
103
98
      break;
104
 
 
105
99
    case ROW_RESULT:                            // Keep compiler happy
 
100
    default:
106
101
      assert(0);
107
102
      break;
108
103
    }
119
114
 
120
115
bool Item_func_get_user_var::const_item() const
121
116
{
122
 
  return (!var_entry || session.getQueryId() != var_entry->update_query_id);
 
117
  return (!var_entry || current_session->query_id != var_entry->update_query_id);
123
118
}
124
119
 
125
120
 
152
147
  return (name.length == other->name.length &&
153
148
          !memcmp(name.str, other->name.str, name.length));
154
149
}
155
 
 
156
 
} /* namespace drizzled */