Drizzled Public API Documentation

user_var_entry.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 
00021 #pragma once
00022 
00023 #include <drizzled/dtcollation.h>
00024 #include <drizzled/item_result.h>
00025 
00026 namespace drizzled {
00027 
00028 class user_var_entry
00029 {
00030 public:
00031   user_var_entry(const char*, query_id_t id) :
00032     value(NULL),
00033     length(0),
00034     size(0),
00035     update_query_id(0),
00036     used_query_id(id),
00037     type(STRING_RESULT),
00038     unsigned_flag(false),
00039     collation(NULL, DERIVATION_IMPLICIT)
00040   { 
00041   }
00042 
00043   ~user_var_entry()
00044   {
00045     free(value);
00046   }
00047 
00048   char* value;
00049   ulong length;
00050   size_t size;
00051   query_id_t update_query_id;
00052   query_id_t used_query_id;
00053   Item_result type;
00054   bool unsigned_flag;
00055   DTCollation collation;
00056 
00057   double val_real(bool *null_value) const;
00058   int64_t val_int(bool *null_value) const;
00059   String *val_str(bool *null_value, String*, uint32_t decimals) const;
00060   type::Decimal *val_decimal(bool *null_value, type::Decimal *result) const;
00061 
00062   void update_hash(bool set_null, data_ref, Item_result type, const charset_info_st* cs, Derivation dv, bool unsigned_arg);
00063 };
00064 
00065 } /* namespace drizzled */
00066