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