~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.h

  • Committer: Brian Aker
  • Date: 2011-01-12 06:45:23 UTC
  • mto: (2073.1.4 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2080.
  • Revision ID: brian@tangent.org-20110112064523-rqhptaqbph22qmj1
Remove custom error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
/* Structs that defines the Table */
22
22
 
23
 
 
24
 
 
25
23
#ifndef DRIZZLED_TABLE_H
26
24
#define DRIZZLED_TABLE_H
27
25
 
28
26
#include <string>
29
27
#include <boost/dynamic_bitset.hpp>
30
28
 
31
 
#include <drizzled/order.h>
32
 
#include <drizzled/filesort_info.h>
33
 
#include <drizzled/natural_join_column.h>
34
 
#include <drizzled/field_iterator.h>
35
 
#include <drizzled/cursor.h>
36
 
#include <drizzled/lex_string.h>
37
 
#include <drizzled/table/instance.h>
38
 
#include <drizzled/atomics.h>
39
 
#include <drizzled/query_id.h>
40
 
 
41
 
#include <drizzled/visibility.h>
 
29
#include "drizzled/order.h"
 
30
#include "drizzled/filesort_info.h"
 
31
#include "drizzled/natural_join_column.h"
 
32
#include "drizzled/field_iterator.h"
 
33
#include "drizzled/cursor.h"
 
34
#include "drizzled/lex_string.h"
 
35
#include "drizzled/table_list.h"
 
36
#include "drizzled/definition/table.h"
 
37
#include "drizzled/atomics.h"
 
38
#include "drizzled/query_id.h"
42
39
 
43
40
namespace drizzled
44
41
{
45
42
 
46
 
class COND_EQUAL;
47
 
class Field_blob;
48
43
class Item;
49
44
class Item_subselect;
 
45
class Select_Lex_Unit;
 
46
class Select_Lex;
 
47
class COND_EQUAL;
50
48
class SecurityContext;
51
 
class Select_Lex;
52
 
class Select_Lex_Unit;
53
49
class TableList;
54
 
namespace field { class Epoch; }
55
 
namespace plugin { class StorageEngine; }
 
50
namespace field {
 
51
class Epoch;
 
52
}
 
53
class Field_blob;
 
54
 
 
55
extern uint64_t refresh_version;
56
56
 
57
57
typedef enum enum_table_category TABLE_CATEGORY;
58
58
typedef struct st_columndef MI_COLUMNDEF;
61
61
 * Class representing a set of records, either in a temporary, 
62
62
 * normal, or derived table.
63
63
 */
64
 
class DRIZZLED_API Table 
 
64
class Table 
65
65
{
66
66
  Field **field; /**< Pointer to fields collection */
 
67
public:
67
68
 
68
 
public:
69
69
  Field **getFields() const
70
70
  {
71
71
    return field;
87
87
  }
88
88
 
89
89
  Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */
90
 
 
91
90
private:
92
91
  Table *next;
93
 
 
94
92
public:
95
93
  Table *getNext() const
96
94
  {
147
145
    return in_use;
148
146
  }
149
147
 
150
 
  unsigned char *getInsertRecord() const
 
148
  unsigned char *getInsertRecord()
151
149
  {
152
150
    return record[0];
153
151
  }
312
310
    The set is implemented as a bitmap.
313
311
  */
314
312
  key_map keys_in_use_for_query;
315
 
 
316
313
  /* Map of keys that can be used to calculate GROUP BY without sorting */
317
314
  key_map keys_in_use_for_group_by;
318
 
 
319
315
  /* Map of keys that can be used to calculate ORDER BY without sorting */
320
316
  key_map keys_in_use_for_order_by;
321
317
 
414
410
 
415
411
    return NULL;
416
412
  }
417
 
  inline uint8_t getBlobPtrSize() const { return getShare()->sizeBlobPtr(); }
418
 
  inline uint32_t getNullBytes() const { return getShare()->null_bytes; }
419
 
  inline uint32_t getNullFields() const { return getShare()->null_fields; }
 
413
  inline uint8_t getBlobPtrSize() { return getShare()->blob_ptr_size; }
 
414
  inline uint32_t getNullBytes() { return getShare()->null_bytes; }
 
415
  inline uint32_t getNullFields() { return getShare()->null_fields; }
420
416
  inline unsigned char *getDefaultValues() { return  getMutableShare()->getDefaultValues(); }
421
417
  inline const char *getSchemaName()  const { return getShare()->getSchemaName(); }
422
418
  inline const char *getTableName()  const { return getShare()->getTableName(); }
423
419
 
424
 
  inline bool isDatabaseLowByteFirst() const { return getShare()->db_low_byte_first; } /* Portable row format */
 
420
  inline bool isDatabaseLowByteFirst() { return getShare()->db_low_byte_first; } /* Portable row format */
425
421
  inline bool isNameLock() const { return open_placeholder; }
426
422
 
427
 
  uint32_t index_flags(uint32_t idx) const;
 
423
  uint32_t index_flags(uint32_t idx) const
 
424
  {
 
425
    return getShare()->storage_engine->index_flags(getShare()->getKeyInfo(idx).algorithm);
 
426
  }
428
427
 
429
428
  inline plugin::StorageEngine *getEngine() const   /* table_type for handler */
430
429
  {
431
 
    return getShare()->getEngine();
 
430
    return getShare()->storage_engine;
432
431
  }
433
432
 
434
433
  Cursor &getCursor() const /* table_type for handler */
499
498
  }
500
499
 
501
500
  /* Both of the below should go away once we can move this bit to the field objects */
502
 
  inline bool isReadSet(uint32_t index) const
 
501
  inline bool isReadSet(uint32_t index)
503
502
  {
504
503
    return read_set->test(index);
505
504
  }
554
553
  {
555
554
    return db_stat || open_placeholder;
556
555
  }
557
 
 
558
556
  /*
559
557
    Is this instance of the table should be reopen or represents a name-lock?
560
558
  */
561
 
  bool needs_reopen_or_name_lock() const;
 
559
  inline bool needs_reopen_or_name_lock()
 
560
  { 
 
561
    return getShare()->getVersion() != refresh_version;
 
562
  }
562
563
 
563
564
  /**
564
565
    clean/setup table fields and map.
579
580
  void filesort_free_buffers(bool full= false);
580
581
  void intern_close_table();
581
582
 
582
 
  void print_error(int error, myf errflag) const;
 
583
  void print_error(int error, myf errflag)
 
584
  {
 
585
    getShare()->storage_engine->print_error(error, errflag, *this);
 
586
  }
583
587
 
584
588
  /**
585
589
    @return
586
590
    key if error because of duplicated keys
587
591
  */
588
 
  uint32_t get_dup_key(int error) const
 
592
  uint32_t get_dup_key(int error)
589
593
  {
590
594
    cursor->errkey  = (uint32_t) -1;
591
595
    if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOREIGN_DUPLICATE_KEY ||
829
833
namespace optimizer { class SqlSelect; }
830
834
 
831
835
void change_double_for_sort(double nr,unsigned char *to);
 
836
double my_double_round(double value, int64_t dec, bool dec_unsigned,
 
837
                       bool truncate);
832
838
int get_quick_record(optimizer::SqlSelect *select);
833
839
 
834
840
void find_date(char *pos,uint32_t *vek,uint32_t flag);
837
843
ulong get_form_pos(int file, unsigned char *head, TYPELIB *save_names);
838
844
void append_unescaped(String *res, const char *pos, uint32_t length);
839
845
 
840
 
DRIZZLED_API int rename_file_ext(const char * from,const char * to,const char * ext);
 
846
int rename_file_ext(const char * from,const char * to,const char * ext);
841
847
bool check_column_name(const char *name);
 
848
bool check_db_name(Session *session, SchemaIdentifier &schema);
842
849
bool check_table_name(const char *name, uint32_t length);
843
850
 
844
851
} /* namespace drizzled */
845
852
 
846
 
#include <drizzled/table/singular.h>
847
 
#include <drizzled/table/concurrent.h>
 
853
#include "drizzled/table/instance.h"
 
854
#include "drizzled/table/concurrent.h"
848
855
 
849
856
#endif /* DRIZZLED_TABLE_H */