~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/user_var_as_out_param.cc

  • Committer: Brian Aker
  • Date: 2008-11-03 03:49:00 UTC
  • mfrom: (520.4.50 devel)
  • Revision ID: brian@tangent.org-20081103034900-znhvcgtipr3tlel5
Merging in Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include <drizzled/functions/user_var_as_out_param.h>
 
23
 
 
24
bool Item_user_var_as_out_param::fix_fields(Session *session, Item **ref)
 
25
{
 
26
  assert(fixed == 0);
 
27
  if (Item::fix_fields(session, ref) ||
 
28
      !(entry= get_variable(&session->user_vars, name, 1)))
 
29
    return true;
 
30
  entry->type= STRING_RESULT;
 
31
  /*
 
32
    Let us set the same collation which is used for loading
 
33
    of fields in LOAD DATA INFILE.
 
34
    (Since Item_user_var_as_out_param is used only there).
 
35
  */
 
36
  entry->collation.set(session->variables.collation_database);
 
37
  entry->update_query_id= session->query_id;
 
38
  return false;
 
39
}
 
40
 
 
41
void Item_user_var_as_out_param::set_null_value(const CHARSET_INFO * const cs)
 
42
{
 
43
  ::update_hash(entry, true, 0, 0, STRING_RESULT, cs,
 
44
                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
 
45
}
 
46
 
 
47
 
 
48
void Item_user_var_as_out_param::set_value(const char *str, uint32_t length,
 
49
                                           const CHARSET_INFO * const cs)
 
50
{
 
51
  ::update_hash(entry, false, (void*)str, length, STRING_RESULT, cs,
 
52
                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
 
53
}
 
54
 
 
55
double Item_user_var_as_out_param::val_real()
 
56
{
 
57
  assert(0);
 
58
  return 0.0;
 
59
}
 
60
 
 
61
 
 
62
int64_t Item_user_var_as_out_param::val_int()
 
63
{
 
64
  assert(0);
 
65
  return 0;
 
66
}
 
67
 
 
68
 
 
69
String* Item_user_var_as_out_param::val_str(String *str __attribute__((unused)))
 
70
{
 
71
  assert(0);
 
72
  return 0;
 
73
}
 
74
 
 
75
my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *decimal_buffer __attribute__((unused)))
 
76
{
 
77
  assert(0);
 
78
  return 0;
 
79
}
 
80
 
 
81
 
 
82
void Item_user_var_as_out_param::print(String *str,
 
83
                                       enum_query_type query_type __attribute__((unused)))
 
84
{
 
85
  str->append('@');
 
86
  str->append(name.str,name.length);
 
87
}
 
88