~ubuntu-branches/ubuntu/maverick/drizzle/maverick

« back to all changes in this revision

Viewing changes to drizzled/function/user_var_as_out_param.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

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 "config.h"
 
21
 
 
22
#include <cassert>
 
23
 
 
24
#include <drizzled/function/user_var_as_out_param.h>
 
25
#include <drizzled/session.h>
 
26
 
 
27
namespace drizzled
 
28
{
 
29
 
 
30
bool Item_user_var_as_out_param::fix_fields(Session *session, Item **ref)
 
31
{
 
32
  assert(fixed == 0);
 
33
  if (Item::fix_fields(session, ref) ||
 
34
      !(entry= session->getVariable(name, true)))
 
35
    return true;
 
36
  entry->type= STRING_RESULT;
 
37
  /*
 
38
    Let us set the same collation which is used for loading
 
39
    of fields in LOAD DATA INFILE.
 
40
    (Since Item_user_var_as_out_param is used only there).
 
41
  */
 
42
  entry->collation.set(default_charset_info);
 
43
  entry->update_query_id= session->getQueryId();
 
44
  return false;
 
45
}
 
46
 
 
47
void Item_user_var_as_out_param::set_null_value(const CHARSET_INFO * const cs)
 
48
{
 
49
  entry->update_hash(true, 0, 0, STRING_RESULT, cs,
 
50
                     DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
 
51
}
 
52
 
 
53
 
 
54
void Item_user_var_as_out_param::set_value(const char *str, uint32_t length,
 
55
                                           const CHARSET_INFO * const cs)
 
56
{
 
57
  entry->update_hash(false, (void*)str, length, STRING_RESULT, cs,
 
58
                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
 
59
}
 
60
 
 
61
double Item_user_var_as_out_param::val_real()
 
62
{
 
63
  assert(0);
 
64
  return 0.0;
 
65
}
 
66
 
 
67
 
 
68
int64_t Item_user_var_as_out_param::val_int()
 
69
{
 
70
  assert(0);
 
71
  return 0;
 
72
}
 
73
 
 
74
 
 
75
String* Item_user_var_as_out_param::val_str(String *)
 
76
{
 
77
  assert(0);
 
78
  return 0;
 
79
}
 
80
 
 
81
my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *)
 
82
{
 
83
  assert(0);
 
84
  return 0;
 
85
}
 
86
 
 
87
 
 
88
void Item_user_var_as_out_param::print(String *str,
 
89
                                       enum_query_type )
 
90
{
 
91
  str->append('@');
 
92
  str->append(name.str,name.length);
 
93
}
 
94
 
 
95
} /* namespace drizzled */