~skinny.moey/drizzle/innodb-replication

« back to all changes in this revision

Viewing changes to plugin/pbxt/src/myxt_xt.cc

  • Committer: Brian Aker
  • Date: 2010-11-08 22:35:57 UTC
  • mfrom: (1802.1.114 trunk)
  • Revision ID: brian@tangent.org-20101108223557-w3xzwp9hjjtjhtc1
MergeĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 *
19
19
 * 2006-05-16   Paul McCullagh
20
20
 *
44
44
#include <drizzled/charset_info.h>
45
45
#include <plugin/myisam/my_handler.h>
46
46
#include <plugin/myisam/myisampack.h>
 
47
#include <boost/filesystem.hpp>
47
48
//extern "C" struct charset_info_st *session_charset(Session *session);
48
49
extern pthread_key_t THR_Session;
49
50
 
 
51
namespace fs=boost::filesystem;
50
52
using namespace drizzled;
51
53
#else
52
54
#include "mysql_priv.h"
661
663
                        memcpy(&data, ((char *) from)+packlength, sizeof(char*));
662
664
                        
663
665
                        //*len = ((Field_blob *) field)->get_length((byte *) from);
664
 
                        *len = ((Field_blob *) field)->get_length((byte *) from, packlength, GET_TABLE_SHARE(table)->db_low_byte_first);
 
666
                        *len = ((Field_blob *) field)->get_length((byte *) from, GET_TABLE_SHARE(table)->db_low_byte_first);
665
667
                        return data;
666
668
                }
667
669
#ifndef DRIZZLED
770
772
                        */
771
773
                        xtWord4 packlength = ((Field_blob *) field)->pack_length_no_ptr();
772
774
 
773
 
                        ((Field_blob *) field)->store_length((byte *) from, packlength, len, GET_TABLE_SHARE(table)->db_low_byte_first);
 
775
                        ((Field_blob *) field)->store_length((byte *) from, len, GET_TABLE_SHARE(table)->db_low_byte_first);
774
776
                        memcpy_fixed(((char *) from)+packlength, &data, sizeof(char*));
775
777
 
776
778
                        if (data)
2029
2031
                        message::Table::STANDARD);
2030
2032
        }
2031
2033
        else {
2032
 
                std::string n(getDataHomeCatalog());
2033
 
                n.append("/");
2034
 
                n.append(database_name);
2035
 
                n.append("/");
2036
 
                n.append(tab_file_name);
2037
 
                ident = new TableIdentifier(database_name, tab_name, n);
 
2034
          fs::path n(getDataHomeCatalog());
 
2035
          n /= database_name;
 
2036
          n /= tab_file_name;
 
2037
                ident = new TableIdentifier(database_name, tab_name, n.file_string());
2038
2038
        }
2039
2039
        
2040
2040
        share = new TableShare(message::Table::STANDARD);
2110
2110
 
2111
2111
        xt_spinlock_free(self, &mi->mi_dirty_lock);
2112
2112
        XT_INDEX_FREE_LOCK(self, mi);
 
2113
#ifndef DRIZZLED
2113
2114
        myxt_bitmap_free(self, &mi->mi_col_map);
 
2115
#endif
2114
2116
        if (mi->mi_free_list)
2115
2117
                xt_free(self, mi->mi_free_list);
2116
2118
 
2140
2142
        uint                                    options = 0;
2141
2143
        u_int                                   key_length = 0;
2142
2144
        xtBool                                  partial_field;
 
2145
    MX_BITMAP               mi_col_map;
2143
2146
 
2144
2147
        enter_();
2145
2148
 
2154
2157
        ind->mi_fix_key = TRUE;
2155
2158
        ind->mi_select_total = 0;
2156
2159
        ind->mi_subset_of = 0;
 
2160
#ifdef DRIZZLED
 
2161
    mi_col_map.resize(GET_TABLE_SHARE(table_arg)->fields);      
 
2162
    mi_col_map.reset();
 
2163
    ind->mi_col_map= mi_col_map.to_ulong();
 
2164
    ind->mi_col_map_size= GET_TABLE_SHARE(table_arg)->fields;
 
2165
#else
2157
2166
        myxt_bitmap_init(self, &ind->mi_col_map, GET_TABLE_SHARE(table_arg)->fields);
 
2167
#endif
2158
2168
        
2159
2169
        ind->mi_seg_count = (uint) index->key_parts;
2160
2170
        key_part_end = index->key_part + index->key_parts;
2301
2311
 
2302
2312
                /* NOTE: do not set if the field is only partially in the index!!! */
2303
2313
                if (!partial_field)
 
2314
#ifdef DRIZZLED
 
2315
                        MX_BIT_FAST_TEST_AND_SET(&mi_col_map, field->field_index);
 
2316
#else
2304
2317
                        MX_BIT_FAST_TEST_AND_SET(&ind->mi_col_map, field->field_index);
 
2318
#endif
2305
2319
        }
2306
2320
 
2307
2321
        if (key_length > XT_INDEX_MAX_KEY_SIZE)
2937
2951
xtPublic void myxt_static_convert_identifier(XTThreadPtr XT_UNUSED(self), MX_CONST_CHARSET_INFO *cs, char *from, char *to, size_t to_len)
2938
2952
{
2939
2953
#ifdef DRIZZLED
2940
 
        ((void *)cs);
 
2954
        ((void)cs);
2941
2955
         xt_strcpy(to_len, to, from);
2942
2956
#else
2943
2957
        uint errors;
2959
2973
{
2960
2974
#ifdef DRIZZLED
2961
2975
        char *to = xt_dup_string(self, from);
2962
 
        ((void *)cs);
 
2976
        ((void)cs);
2963
2977
#else
2964
2978
        uint    errors;
2965
2979
        u_int   len;
3046
3060
                THD *thd = current_thd;
3047
3061
 
3048
3062
                if (thd)
3049
 
                        return (MX_CHARSET_INFO *)thd_charset(thd);
 
3063
                        return (MX_CHARSET_INFO *)thd->charset();
3050
3064
        }
3051
3065
        return (MX_CHARSET_INFO *)&my_charset_utf8_general_ci;
3052
3066
}
3346
3360
 
3347
3361
static void myxt_bitmap_init(XTThreadPtr self, MX_BITMAP *map, u_int n_bits)
3348
3362
{
 
3363
#ifdef DRIZZLED
 
3364
    (void) self;
 
3365
    map= new boost::dynamic_bitset<>(n_bits);
 
3366
    map->resize(n_bits);
 
3367
    map->reset();
 
3368
#else
3349
3369
        my_bitmap_map   *buf;
3350
3370
    uint                        size_in_bytes = (((n_bits) + 31) / 32) * 4;
3351
 
 
3352
3371
        buf = (my_bitmap_map *) xt_malloc(self, size_in_bytes);
3353
 
 
3354
 
#ifdef DRIZZLED
3355
 
        map->init(buf, n_bits);
3356
 
#else
3357
3372
        map->bitmap= buf;
3358
3373
        map->n_bits= n_bits;
3359
3374
        create_last_word_mask(map);
3364
3379
static void myxt_bitmap_free(XTThreadPtr self, MX_BITMAP *map)
3365
3380
{
3366
3381
#ifdef DRIZZLED
3367
 
        my_bitmap_map *buf = map->getBitmap();
3368
 
        if (buf)
3369
 
                xt_free(self, buf);
3370
 
        map->setBitmap(NULL);
 
3382
    (void) self;
 
3383
    if (map->empty())
 
3384
        map->clear();
 
3385
    delete map;
3371
3386
#else
3372
3387
        if (map->bitmap) {
3373
3388
                xt_free(self, map->bitmap);