~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:24:18 UTC
  • mfrom: (2159.1.1 remove-lint)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172418-vd210j88hiwk8jih
Removed the lint stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
 
17
17
/* Functions to handle keys and fields in forms */
20
20
#include "drizzled/table.h"
21
21
#include "drizzled/key.h"
22
22
#include "drizzled/field/blob.h"
 
23
#include "drizzled/util/test.h"
 
24
#include "drizzled/plugin/storage_engine.h"
 
25
 
 
26
#include <boost/dynamic_bitset.hpp>
23
27
 
24
28
#include <string>
25
29
 
326
330
     idx        Key number
327
331
*/
328
332
 
329
 
void key_unpack(String *to, Table *table, uint32_t idx)
 
333
void key_unpack(String *to, const Table *table, uint32_t idx)
330
334
{
331
335
  KeyPartInfo *key_part,*key_part_end;
332
336
  Field *field;
352
356
    {
353
357
      const CHARSET_INFO * const cs= field->charset();
354
358
      field->setReadSet();
355
 
      field->val_str(&tmp);
 
359
      field->val_str_internal(&tmp);
356
360
      if (cs->mbmaxlen > 1 &&
357
361
          table->getField(key_part->fieldnr - 1)->field_length !=
358
362
          key_part->length)
372
376
      }
373
377
 
374
378
      if (key_part->length < field->pack_length())
375
 
        tmp.length(min(tmp.length(),(uint32_t)key_part->length));
 
379
        tmp.length(min(tmp.length(), static_cast<size_t>(key_part->length)));
376
380
      to->append(tmp);
377
381
    }
378
382
    else
399
403
    FALSE  Otherwise
400
404
*/
401
405
 
402
 
bool is_key_used(Table *table, uint32_t idx, const MyBitmap *fields)
 
406
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields)
403
407
{
404
 
  table->tmp_set.clearAll();
405
 
  table->mark_columns_used_by_index_no_reset(idx, &table->tmp_set);
406
 
  if (bitmap_is_overlapping(&table->tmp_set, fields))
 
408
  table->tmp_set.reset();
 
409
  table->mark_columns_used_by_index_no_reset(idx, table->tmp_set);
 
410
  if (table->tmp_set.is_subset_of(fields))
407
411
    return 1;
408
412
 
409
413
  /*