~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_update.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-04-11 02:32:57 UTC
  • mto: (971.1.63 mordred)
  • mto: This revision was merged to the branch mainline in revision 990.
  • Revision ID: osullivan.padraig@gmail.com-20090411023257-2pz255xvtzfhrart
Added new functions for adding a bitset in a thread-safe way. I created a
class which simply consists of 2 class members: 1) a lock and 2) a
std::bitset.

Also, moved some helper functions to a separate new file (sql_bitmap.cc).

Nearly all instances of My_BITMAP are replaced now. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
  return false;
66
66
}
67
67
 
68
 
/*
69
 
 * This helper function returns true if map1 is a subset of
70
 
 * map2; otherwise it returns false.
71
 
 */
72
 
static bool is_bitmap_subset(bitset<MAX_FIELDS> *map1, bitset<MAX_FIELDS> *map2)
73
 
{
74
 
  bitset<MAX_FIELDS> tmp1= *map2;
75
 
  tmp1.flip();
76
 
  bitset<MAX_FIELDS> tmp2= *map1 & tmp1;
77
 
  return (!tmp2.any());
78
 
}
79
 
 
80
 
 
81
 
 
82
68
/**
83
69
  Re-read record if more columns are needed for error message.
84
70
 
497
483
  */
498
484
  can_compare_record= (!(table->file->ha_table_flags() &
499
485
                         HA_PARTIAL_COLUMN_READ) ||
500
 
                       is_bitmap_subset(table->write_set, table->read_set));
 
486
                       isBitmapSubset(table->write_set, table->read_set));
501
487
 
502
488
  while (!(error=info.read_record(&info)) && !session->killed)
503
489
  {
1336
1322
      bool can_compare_record;
1337
1323
      can_compare_record= (!(table->file->ha_table_flags() &
1338
1324
                             HA_PARTIAL_COLUMN_READ) ||
1339
 
                           is_bitmap_subset(table->write_set,
1340
 
                                            table->read_set));
 
1325
                           isBitmapSubset(table->write_set,
 
1326
                                          table->write_set));
1341
1327
      table->status|= STATUS_UPDATED;
1342
1328
      store_record(table,record[1]);
1343
1329
      if (fill_record(session, *fields_for_table[offset],
1536
1522
 
1537
1523
    can_compare_record= (!(table->file->ha_table_flags() &
1538
1524
                           HA_PARTIAL_COLUMN_READ) ||
1539
 
                         is_bitmap_subset(table->write_set,
1540
 
                                          table->read_set));
 
1525
                         isBitmapSubset(table->write_set,
 
1526
                                        table->read_set));
1541
1527
 
1542
1528
    for (;;)
1543
1529
    {