~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.h

  • Committer: Monty Taylor
  • Date: 2010-03-11 18:27:20 UTC
  • mfrom: (1333 staging)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: mordred@inaugust.com-20100311182720-hd1h87y6cb1b1mp0
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
class Select_Lex_Unit;
45
45
class Select_Lex;
46
46
class COND_EQUAL;
47
 
class Security_context;
 
47
class SecurityContext;
48
48
class TableList;
49
49
class Field_timestamp;
50
50
class Field_blob;
85
85
  MyBitmap tmp_set; /* Not sure about this... */
86
86
 
87
87
  Session *in_use; /**< Pointer to the current session using this object */
 
88
  Session *getSession()
 
89
  {
 
90
    return in_use;
 
91
  }
88
92
 
89
93
  unsigned char *record[2]; /**< Pointer to "records" */
90
94
  unsigned char *insert_values; /* used by INSERT ... UPDATE */
253
257
  void resetTable(Session *session, TableShare *share, uint32_t db_stat_arg);
254
258
 
255
259
  /* SHARE methods */
256
 
  inline TableShare *getShare() { return s; } /* Get rid of this long term */
 
260
  inline const TableShare *getShare() const { assert(s); return s; } /* Get rid of this long term */
257
261
  inline void setShare(TableShare *new_share) { s= new_share; } /* Get rid of this long term */
258
262
  inline uint32_t sizeKeys() { return s->keys; }
259
263
  inline uint32_t sizeFields() { return s->fields; }
279
283
    return s->storage_engine;
280
284
  }
281
285
 
 
286
  Cursor &getCursor() const     /* table_type for handler */
 
287
  {
 
288
    assert(cursor);
 
289
    return *cursor;
 
290
  }
 
291
 
282
292
  /* For TMP tables, should be pulled out as a class */
283
293
  void updateCreateInfo(message::Table *table_proto);
284
294
  void setup_tmp_table_column_bitmaps(unsigned char *bitmaps);
454
464
 
455
465
    return(cursor->errkey);
456
466
  }
 
467
 
 
468
  /*
 
469
    This is a short term fix. Long term we will used the TableIdentifier to do the actual comparison.
 
470
  */
 
471
  bool operator<(const Table &right) const
 
472
  {
 
473
    int result= strcmp(this->getShare()->getSchemaName(), right.getShare()->getSchemaName());
 
474
 
 
475
    if (result <  0)
 
476
      return true;
 
477
 
 
478
    if (result >  0)
 
479
      return false;
 
480
 
 
481
    result= strcmp(this->getShare()->getTableName(), right.getShare()->getTableName());
 
482
 
 
483
    if (result <  0)
 
484
      return true;
 
485
 
 
486
    if (result >  0)
 
487
      return false;
 
488
 
 
489
    if (this->getShare()->getTableProto()->type()  < 
 
490
        right.getShare()->getTableProto()->type())
 
491
      return true;
 
492
 
 
493
    return false;
 
494
  }
 
495
 
 
496
  static bool compare(const Table *a, const Table *b)
 
497
  {
 
498
    return *a < *b;
 
499
  }
 
500
 
 
501
  friend std::ostream& operator<<(std::ostream& output, const Table &table)
 
502
  {
 
503
    output << "Table:(";
 
504
    output << table.getShare()->getSchemaName();
 
505
    output << ", ";
 
506
    output <<  table.getShare()->getTableName();
 
507
    output << ", ";
 
508
    output <<  table.getShare()->getTableTypeAsString();
 
509
    output << ")";
 
510
 
 
511
    return output;  // for multiple << operators.
 
512
  }
 
513
 
457
514
};
458
515
 
459
516
Table *create_virtual_tmp_table(Session *session, List<CreateField> &field_list);