~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.h

  • Committer: Monty Taylor
  • Date: 2008-12-06 07:22:02 UTC
  • mto: (656.1.7 devel) (660.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: monty@inaugust.com-20081206072202-2g25o9doqr1l8euu
OOOh doggie. Got rid of my_alloca.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
  =================
122
122
  [Warning: this description is work in progress and may be incomplete]
123
123
  The table record is stored in a fixed-size buffer:
124
 
 
 
124
   
125
125
    record: null_bytes, column1_data, column2_data, ...
126
 
 
127
 
  The offsets of the parts of the buffer are also fixed: every column has
 
126
  
 
127
  The offsets of the parts of the buffer are also fixed: every column has 
128
128
  an offset to its column{i}_data, and if it is nullable it also has its own
129
 
  bit in null_bytes.
 
129
  bit in null_bytes. 
130
130
 
131
131
  The record buffer only includes data about columns that are marked in the
132
132
  relevant column set (table->read_set and/or table->write_set, depending on
133
 
  the situation).
 
133
  the situation). 
134
134
  <not-sure>It could be that it is required that null bits of non-present
135
135
  columns are set to 1</not-sure>
136
136
 
137
137
  VARIOUS EXCEPTIONS AND SPECIAL CASES
138
138
 
139
 
  f the table has no nullable columns, then null_bytes is still
140
 
  present, its length is one byte <not-sure> which must be set to 0xFF
 
139
  f the table has no nullable columns, then null_bytes is still 
 
140
  present, its length is one byte <not-sure> which must be set to 0xFF 
141
141
  at all times. </not-sure>
142
 
 
 
142
  
143
143
  If the table has columns of type BIT, then certain bits from those columns
144
144
  may be stored in null_bytes as well. Grep around for Field_bit for
145
145
  details.
146
146
 
147
 
  For blob columns (see Field_blob), the record buffer stores length of the
148
 
  data, following by memory pointer to the blob data. The pointer is owned
 
147
  For blob columns (see Field_blob), the record buffer stores length of the 
 
148
  data, following by memory pointer to the blob data. The pointer is owned 
149
149
  by the storage engine and is valid until the next operation.
150
150
 
151
151
  If a blob column has NULL value, then its length and blob data pointer
186
186
  KEY_PART_INFO *range_key_part;
187
187
  int key_compare_result_on_equal;
188
188
  bool eq_range;
189
 
  /*
 
189
  /* 
190
190
    true <=> the engine guarantees that returned records are within the range
191
191
    being scanned.
192
192
  */
317
317
  { return rows2double(ranges+rows); }
318
318
 
319
319
  virtual double index_only_read_time(uint32_t keynr, double records);
320
 
 
 
320
  
321
321
  virtual ha_rows multi_range_read_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
322
 
                                              void *seq_init_param,
 
322
                                              void *seq_init_param, 
323
323
                                              uint32_t n_ranges, uint32_t *bufsz,
324
324
                                              uint32_t *flags, COST_VECT *cost);
325
325
  virtual int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys,
681
681
      anything
682
682
 
683
683
    This method offers the storage engine, the possibility to store a reference
684
 
    to a table name which is going to be used with query cache.
 
684
    to a table name which is going to be used with query cache. 
685
685
    The method is called each time a statement is written to the cache and can
686
686
    be used to verify if a specific statement is cachable. It also offers
687
687
    the possibility to register a generic (but static) call back function which
738
738
   @note
739
739
   The pushed conditions form a stack (from which one can remove the
740
740
   last pushed condition using cond_pop).
741
 
   The table handler filters out rows using (pushed_cond1 AND pushed_cond2
 
741
   The table handler filters out rows using (pushed_cond1 AND pushed_cond2 
742
742
   AND ... AND pushed_condN)
743
743
   or less restrictive condition, depending on handler's capabilities.
744
744
 
745
745
   handler->ha_reset() call empties the condition stack.
746
746
   Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
747
747
   condition stack.
748
 
 */
 
748
 */ 
749
749
 virtual const COND *cond_push(const COND *cond) { return cond; }
750
750
 
751
751
 /**
893
893
    This procedure defines if the storage engine supports virtual columns.
894
894
    Default false means "not supported".
895
895
  */
896
 
  virtual bool check_if_supported_virtual_columns(void)
 
896
  virtual bool check_if_supported_virtual_columns(void) 
897
897
  { return false; }
898
898
 
899
899
protected:
1004
1004
  virtual void start_bulk_insert(ha_rows)
1005
1005
  {}
1006
1006
  virtual int end_bulk_insert(void) { return 0; }
1007
 
  virtual int index_read(unsigned char *, const unsigned char *,
 
1007
  virtual int index_read(unsigned char *, const unsigned char *, 
1008
1008
                         uint32_t, enum ha_rkey_function)
1009
1009
   { return  HA_ERR_WRONG_COMMAND; }
1010
1010
  virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t)
1069
1069
  A Disk-Sweep MRR interface implementation
1070
1070
 
1071
1071
  This implementation makes range (and, in the future, 'ref') scans to read
1072
 
  table rows in disk sweeps.
1073
 
 
 
1072
  table rows in disk sweeps. 
 
1073
  
1074
1074
  Currently it is used by MyISAM and InnoDB. Potentially it can be used with
1075
1075
  any table handler that has non-clustered indexes and on-disk rows.
1076
1076
*/
1107
1107
public:
1108
1108
  void init(handler *h_arg, Table *table_arg)
1109
1109
  {
1110
 
    h= h_arg;
 
1110
    h= h_arg; 
1111
1111
    table= table_arg;
1112
1112
  }
1113
 
  int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs,
1114
 
                 void *seq_init_param, uint32_t n_ranges, uint32_t mode,
 
1113
  int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs, 
 
1114
                 void *seq_init_param, uint32_t n_ranges, uint32_t mode, 
1115
1115
                 HANDLER_BUFFER *buf);
1116
1116
  void dsmrr_close();
1117
1117
  int dsmrr_fill_buffer(handler *h);
1120
1120
  int dsmrr_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz,
1121
1121
                 uint32_t *flags, COST_VECT *cost);
1122
1122
 
1123
 
  ha_rows dsmrr_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
 
1123
  ha_rows dsmrr_info_const(uint32_t keyno, RANGE_SEQ_IF *seq, 
1124
1124
                            void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz,
1125
1125
                            uint32_t *flags, COST_VECT *cost);
1126
1126
private:
1127
1127
  bool key_uses_partial_cols(uint32_t keyno);
1128
 
  bool choose_mrr_impl(uint32_t keyno, ha_rows rows, uint32_t *flags, uint32_t *bufsz,
 
1128
  bool choose_mrr_impl(uint32_t keyno, ha_rows rows, uint32_t *flags, uint32_t *bufsz, 
1129
1129
                       COST_VECT *cost);
1130
 
  bool get_disk_sweep_mrr_cost(uint32_t keynr, ha_rows rows, uint32_t flags,
 
1130
  bool get_disk_sweep_mrr_cost(uint32_t keynr, ha_rows rows, uint32_t flags, 
1131
1131
                               uint32_t *buffer_size, COST_VECT *cost);
1132
1132
};
1133
1133
 
1352
1352
Table *drop_locked_tables(Session *session,const char *db, const char *table_name);
1353
1353
void abort_locked_tables(Session *session,const char *db, const char *table_name);
1354
1354
void execute_init_command(Session *session, sys_var_str *init_command_var,
1355
 
                          pthread_rwlock_t *var_mutex);
 
1355
                          rw_lock_t *var_mutex);
1356
1356
extern Field *not_found_field;
1357
1357
extern Field *view_ref_found;
1358
1358