Drizzled Public API Documentation

copy_field.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/memory/sql_alloc.h>
00024 #include <drizzled/sql_string.h>
00025 
00026 
00027 namespace drizzled {
00028 
00029 class Field;
00030 
00034 class CopyField :public memory::SqlAlloc
00035 {
00040   typedef void Copy_func(CopyField*);
00041   Copy_func *get_copy_func(Field *to, Field *from);
00042 
00043 public:
00044   unsigned char *from_ptr;
00045   unsigned char *to_ptr;
00046   unsigned char *from_null_ptr;
00047   unsigned char *to_null_ptr;
00048   bool *null_row;
00049   uint32_t from_bit;
00050   uint32_t to_bit;
00051   uint32_t from_length;
00052   uint32_t to_length;
00053   Field *from_field;
00054   Field *to_field;
00055   String tmp;         // For items
00056 
00057   CopyField() :
00058     from_ptr(0),
00059     to_ptr(0),
00060     from_null_ptr(0),
00061     to_null_ptr(0),
00062     null_row(0),
00063     from_bit(0),
00064     to_bit(0),
00065     from_length(0),
00066     to_length(0),
00067     from_field(0),
00068     to_field(0)
00069   {}
00070 
00071   ~CopyField()
00072   {}
00073 
00074   void set(Field *to,Field *from,bool save);  // Field to field
00075   void set(unsigned char *to,Field *from);    // Field to string
00076   void (*do_copy)(CopyField *);
00077   void (*do_copy2)(CopyField *);    // Used to handle null values
00078 };
00079 
00080 } /* namespace drizzled */
00081