~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.cc

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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>
27
23
 
28
24
#include <string>
29
25
 
330
326
     idx        Key number
331
327
*/
332
328
 
333
 
void key_unpack(String *to, const Table *table, uint32_t idx)
 
329
void key_unpack(String *to, Table *table, uint32_t idx)
334
330
{
335
331
  KeyPartInfo *key_part,*key_part_end;
336
332
  Field *field;
356
352
    {
357
353
      const CHARSET_INFO * const cs= field->charset();
358
354
      field->setReadSet();
359
 
      field->val_str_internal(&tmp);
 
355
      field->val_str(&tmp);
360
356
      if (cs->mbmaxlen > 1 &&
361
357
          table->getField(key_part->fieldnr - 1)->field_length !=
362
358
          key_part->length)
376
372
      }
377
373
 
378
374
      if (key_part->length < field->pack_length())
379
 
        tmp.length(min(tmp.length(), static_cast<size_t>(key_part->length)));
 
375
        tmp.length(min(tmp.length(),(uint32_t)key_part->length));
380
376
      to->append(tmp);
381
377
    }
382
378
    else
403
399
    FALSE  Otherwise
404
400
*/
405
401
 
406
 
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields)
 
402
bool is_key_used(Table *table, uint32_t idx, const MyBitmap *fields)
407
403
{
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))
 
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))
411
407
    return 1;
412
408
 
413
409
  /*