~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.h

  • Committer: Lee
  • Date: 2008-10-03 23:31:06 UTC
  • mfrom: (413.2.3 drizzle)
  • mto: This revision was merged to the branch mainline in revision 459.
  • Revision ID: lbieber@lbieber-desktop-20081003233106-tgvzu0fh25gb3xeg
breaking out enum field classes

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
  KEY  *key_info;                       /* data of keys in database */
163
163
  uint  *blob_field;                    /* Index to blobs in Field arrray*/
164
164
 
165
 
  unsigned char *default_values;                /* row with default values */
 
165
  uchar *default_values;                /* row with default values */
166
166
  LEX_STRING comment;                   /* Comment about table */
167
167
  const CHARSET_INFO *table_charset; /* Default charset of string fields */
168
168
 
196
196
  uint32_t   version, mysql_version;
197
197
  uint32_t   timestamp_offset;          /* Set to offset+1 of record */
198
198
  uint32_t   reclength;                 /* Recordlength */
199
 
  uint32_t   stored_rec_length;         /* Stored record length 
200
 
                                           (no generated-only virtual fields) */
201
199
 
202
200
  plugin_ref db_plugin;                 /* storage engine plugin */
203
201
  inline handlerton *db_type() const    /* table_type for handler */
210
208
  enum ha_choice transactional;
211
209
  enum ha_choice page_checksum;
212
210
 
213
 
  uint32_t ref_count;       /* How many Table objects uses this */
214
 
  uint32_t open_count;                  /* Number of tables in open list */
215
 
  uint32_t blob_ptr_size;                       /* 4 or 8 */
216
 
  uint32_t key_block_size;                      /* create key_block_size, if used */
217
 
  uint32_t null_bytes, last_null_bit_pos;
218
 
  uint32_t fields;                              /* Number of fields */
219
 
  uint32_t stored_fields;                   /* Number of stored fields 
220
 
                                           (i.e. without generated-only ones) */
221
 
  uint32_t rec_buff_length;                 /* Size of table->record[] buffer */
222
 
  uint32_t keys, key_parts;
223
 
  uint32_t max_key_length, max_unique_length, total_key_length;
224
 
  uint32_t uniques;                         /* Number of UNIQUE index */
225
 
  uint32_t null_fields;                 /* number of null fields */
226
 
  uint32_t blob_fields;                 /* number of blob fields */
227
 
  uint32_t timestamp_field_offset;              /* Field number for timestamp field */
228
 
  uint32_t varchar_fields;                  /* number of varchar fields */
229
 
  uint32_t db_create_options;           /* Create options from database */
230
 
  uint32_t db_options_in_use;           /* Options in use */
231
 
  uint32_t db_record_offset;            /* if HA_REC_IN_SEQ */
232
 
  uint32_t rowid_field_offset;          /* Field_nr +1 to rowid field */
 
211
  uint ref_count;                       /* How many Table objects uses this */
 
212
  uint open_count;                      /* Number of tables in open list */
 
213
  uint blob_ptr_size;                   /* 4 or 8 */
 
214
  uint key_block_size;                  /* create key_block_size, if used */
 
215
  uint null_bytes, last_null_bit_pos;
 
216
  uint fields;                          /* Number of fields */
 
217
  uint rec_buff_length;                 /* Size of table->record[] buffer */
 
218
  uint keys, key_parts;
 
219
  uint max_key_length, max_unique_length, total_key_length;
 
220
  uint uniques;                         /* Number of UNIQUE index */
 
221
  uint null_fields;                     /* number of null fields */
 
222
  uint blob_fields;                     /* number of blob fields */
 
223
  uint timestamp_field_offset;          /* Field number for timestamp field */
 
224
  uint varchar_fields;                  /* number of varchar fields */
 
225
  uint db_create_options;               /* Create options from database */
 
226
  uint db_options_in_use;               /* Options in use */
 
227
  uint db_record_offset;                /* if HA_REC_IN_SEQ */
 
228
  uint rowid_field_offset;              /* Field_nr +1 to rowid field */
233
229
  /* Index of auto-updated TIMESTAMP field in field array */
234
 
  uint32_t primary_key;
235
 
  uint32_t next_number_index;               /* autoincrement key number */
236
 
  uint32_t next_number_key_offset;          /* autoinc keypart offset in a key */
237
 
  uint32_t next_number_keypart;             /* autoinc keypart number in a key */
238
 
  uint32_t error, open_errno, errarg;       /* error from open_table_def() */
239
 
  uint32_t column_bitmap_size;
240
 
  unsigned char frm_version;
241
 
  uint32_t vfields;                         /* Number of virtual fields */
 
230
  uint primary_key;
 
231
  uint next_number_index;               /* autoincrement key number */
 
232
  uint next_number_key_offset;          /* autoinc keypart offset in a key */
 
233
  uint next_number_keypart;             /* autoinc keypart number in a key */
 
234
  uint error, open_errno, errarg;       /* error from open_table_def() */
 
235
  uint column_bitmap_size;
 
236
  uchar frm_version;
242
237
  bool null_field_first;
243
238
  bool db_low_byte_first;               /* Portable row format */
244
239
  bool crashed;
271
266
      appropriate values by using table cache key as their source.
272
267
  */
273
268
 
274
 
  void set_table_cache_key(char *key_buff, uint32_t key_length)
 
269
  void set_table_cache_key(char *key_buff, uint key_length)
275
270
  {
276
271
    table_cache_key.str= key_buff;
277
272
    table_cache_key.length= key_length;
301
296
      it should has same life-time as share itself.
302
297
  */
303
298
 
304
 
  void set_table_cache_key(char *key_buff, const char *key, uint32_t key_length)
 
299
  void set_table_cache_key(char *key_buff, const char *key, uint key_length)
305
300
  {
306
301
    memcpy(key_buff, key, key_length);
307
302
    set_table_cache_key(key_buff, key_length);
351
346
  /* SHARE methods */
352
347
  inline TABLE_SHARE *getShare() { return s; } /* Get rid of this long term */
353
348
  inline void setShare(TABLE_SHARE *new_share) { s= new_share; } /* Get rid of this long term */
354
 
  inline uint32_t sizeKeys() { return s->keys; }
355
 
  inline uint32_t sizeFields() { return s->fields; }
356
 
  inline uint32_t getRecordLength() { return s->reclength; }
357
 
  inline uint32_t sizeBlobFields() { return s->blob_fields; }
358
 
  inline uint32_t *getBlobField() { return s->blob_field; }
359
 
  inline uint32_t getNullBytes() { return s->null_bytes; }
360
 
  inline uint32_t getNullFields() { return s->null_fields; }
 
349
  inline uint sizeKeys() { return s->keys; }
 
350
  inline uint sizeFields() { return s->fields; }
 
351
  inline uint getRecordLength() { return s->reclength; }
 
352
  inline uint sizeBlobFields() { return s->blob_fields; }
 
353
  inline uint *getBlobField() { return s->blob_field; }
 
354
  inline uint getNullBytes() { return s->null_bytes; }
 
355
  inline uint getNullFields() { return s->null_fields; }
361
356
  inline unsigned char *getDefaultValues() { return s->default_values; }
362
357
 
363
358
  inline bool isNullFieldFirst() { return s->null_field_first; }
369
364
 
370
365
  /* For TMP tables, should be pulled out as a class */
371
366
  void updateCreateInfo(HA_CREATE_INFO *create_info);
372
 
  void setup_tmp_table_column_bitmaps(unsigned char *bitmaps);
 
367
  void setup_tmp_table_column_bitmaps(uchar *bitmaps);
373
368
  bool create_myisam_tmp_table(KEY *keyinfo, 
374
369
                               MI_COLUMNDEF *start_recinfo,
375
370
                               MI_COLUMNDEF **recinfo, 
376
371
                               uint64_t options);
377
372
  void free_tmp_table(THD *thd);
378
373
  bool open_tmp_table();
379
 
  size_t max_row_length(const unsigned char *data);
380
 
  uint32_t find_shortest_key(const key_map *usable_keys);
 
374
  size_t max_row_length(const uchar *data);
 
375
  uint find_shortest_key(const key_map *usable_keys);
381
376
  bool compare_record(Field **ptr);
382
377
  bool compare_record();
383
378
 
384
 
  bool table_check_intact(const uint32_t table_f_count, const TABLE_FIELD_W_TYPE *table_def);
 
379
  bool table_check_intact(const uint table_f_count, const TABLE_FIELD_W_TYPE *table_def);
385
380
 
386
381
  /* See if this can be blown away */
387
 
  inline uint32_t getDBStat () { return db_stat; }
388
 
  inline uint32_t setDBStat () { return db_stat; }
 
382
  inline uint getDBStat () { return db_stat; }
 
383
  inline uint setDBStat () { return db_stat; }
389
384
  uint          db_stat;                /* mode of file as in handler.h */
390
385
 
391
386
  handler       *file;
394
389
  THD   *in_use;                        /* Which thread uses this */
395
390
  Field **field;                        /* Pointer to fields */
396
391
 
397
 
  unsigned char *record[2];                     /* Pointer to records */
398
 
  unsigned char *write_row_record;              /* Used as optimisation in
 
392
  uchar *record[2];                     /* Pointer to records */
 
393
  uchar *write_row_record;              /* Used as optimisation in
399
394
                                           THD::write_row */
400
 
  unsigned char *insert_values;                  /* used by INSERT ... UPDATE */
 
395
  uchar *insert_values;                  /* used by INSERT ... UPDATE */
401
396
  /* 
402
397
    Map of keys that can be used to retrieve all data from this table 
403
398
    needed by the query without reading the row.
425
420
  Field *next_number_field;             /* Set if next_number is activated */
426
421
  Field *found_next_number_field;       /* Set on open */
427
422
  Field_timestamp *timestamp_field;
428
 
  Field **vfield;                       /* Pointer to virtual fields*/
429
423
 
430
424
  TableList *pos_in_table_list;/* Element referring to this table */
431
425
  order_st *group;
432
426
  const char    *alias;                   /* alias or table name */
433
 
  unsigned char         *null_flags;
 
427
  uchar         *null_flags;
434
428
  my_bitmap_map *bitmap_init_value;
435
429
  MY_BITMAP     def_read_set, def_write_set, tmp_set; /* containers */
436
430
  MY_BITMAP     *read_set, *write_set;          /* Active column sets */
491
485
  timestamp_auto_set_type timestamp_field_type;
492
486
  table_map     map;                    /* ID bit of table (1,2,4,8,16...) */
493
487
 
494
 
  uint32_t          lock_position;          /* Position in DRIZZLE_LOCK.table */
495
 
  uint32_t          lock_data_start;        /* Start pos. in DRIZZLE_LOCK.locks */
496
 
  uint32_t          lock_count;             /* Number of locks */
 
488
  uint          lock_position;          /* Position in DRIZZLE_LOCK.table */
 
489
  uint          lock_data_start;        /* Start pos. in DRIZZLE_LOCK.locks */
 
490
  uint          lock_count;             /* Number of locks */
497
491
  uint          tablenr,used_fields;
498
 
  uint32_t          temp_pool_slot;             /* Used by intern temp tables */
 
492
  uint          temp_pool_slot;         /* Used by intern temp tables */
499
493
  uint          status;                 /* What's in record[0] */
500
494
  /* number of select if it is derived table */
501
 
  uint32_t          derived_select_number;
 
495
  uint          derived_select_number;
502
496
  int           current_lock;           /* Type of lock on table */
503
497
  bool copy_blobs;                      /* copy_blobs when storing */
504
498
 
560
554
  void reset_item_list(List<Item> *item_list) const;
561
555
  void clear_column_bitmaps(void);
562
556
  void prepare_for_position(void);
563
 
  void mark_columns_used_by_index_no_reset(uint32_t index, MY_BITMAP *map);
564
 
  void mark_columns_used_by_index(uint32_t index);
 
557
  void mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *map);
 
558
  void mark_columns_used_by_index(uint index);
565
559
  void restore_column_maps_after_mark_index();
566
560
  void mark_auto_increment_column(void);
567
561
  void mark_columns_needed_for_update(void);
568
562
  void mark_columns_needed_for_delete(void);
569
563
  void mark_columns_needed_for_insert(void);
570
 
  void mark_virtual_columns(void);
571
564
  inline void column_bitmaps_set(MY_BITMAP *read_set_arg,
572
565
                                 MY_BITMAP *write_set_arg)
573
566
  {
667
660
     For string-type columns, this is the maximum number of
668
661
     characters. Otherwise, it is the 'display-length' for the column.
669
662
  */
670
 
  uint32_t field_length;
 
663
  uint field_length;
671
664
  /**
672
665
     This denotes data type for the column. For the most part, there seems to
673
666
     be one entry in the enum for each SQL data type, although there seem to
683
676
     combine them using the bitwise or operator @c |. Both flags are
684
677
     defined in table.h.
685
678
   */
686
 
  uint32_t field_flags;        // Field atributes(maybe_null, signed, unsigned etc.)
 
679
  uint field_flags;        // Field atributes(maybe_null, signed, unsigned etc.)
687
680
  const char* old_name;
688
681
  /**
689
682
     This should be one of @c SKIP_OPEN_TABLE,
690
683
     @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE.
691
684
  */
692
 
  uint32_t open_method;
 
685
  uint open_method;
693
686
} ST_FIELD_INFO;
694
687
 
695
688
 
710
703
                        bool res, LEX_STRING *db_name, LEX_STRING *table_name);
711
704
  int idx_field1, idx_field2; 
712
705
  bool hidden;
713
 
  uint32_t i_s_requested_object;  /* the object we need to open(Table | VIEW) */
 
706
  uint i_s_requested_object;  /* the object we need to open(Table | VIEW) */
714
707
};
715
708
 
716
709