~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to sql/handler.h

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#pragma interface                       /* gcc class implementation */
21
21
#endif
22
22
 
 
23
#include <my_handler.h>
23
24
#include <ft_global.h>
24
25
#include <keycache.h>
25
26
 
162
163
#define HA_CAN_FULLTEXT        (1 << 21)
163
164
#define HA_CAN_SQL_HANDLER     (1 << 22)
164
165
#define HA_NO_AUTO_INCREMENT   (1 << 23)
165
 
#define HA_HAS_CHECKSUM        (1 << 24)
 
166
/* Has automatic checksums and uses the old checksum format */
 
167
#define HA_HAS_OLD_CHECKSUM    (1 << 24)
166
168
/* Table data are stored in separate files (for lower_case_table_names) */
167
169
#define HA_FILE_BASED          (1 << 26)
168
170
#define HA_NO_VARCHAR          (1 << 27)
183
185
#define HA_BINLOG_STMT_CAPABLE (LL(1) << 36)
184
186
 
185
187
#define HA_ONLINE_ALTER        (LL(1) << 37)
 
188
#define HA_CAN_READ_ORDER_IF_LIMIT (LL(1) << 38)
 
189
/* Has automatic checksums and uses the new checksum format */
 
190
#define HA_HAS_NEW_CHECKSUM    (LL(1) << 39)
186
191
 
187
192
/*
188
193
  Set of all binlog flags. Currently only contain the capabilities
278
283
#define HA_LEX_CREATE_TMP_TABLE 1
279
284
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
280
285
#define HA_LEX_CREATE_TABLE_LIKE 4
281
 
#define HA_OPTION_NO_CHECKSUM   (1L << 17)
282
 
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
283
286
#define HA_MAX_REC_LENGTH       65535
284
287
 
285
288
/* Table caching type */
314
317
  DB_TYPE_TABLE_FUNCTION,
315
318
  DB_TYPE_MEMCACHE,
316
319
  DB_TYPE_FALCON,
 
320
  DB_TYPE_MARIA,
317
321
  DB_TYPE_FIRST_DYNAMIC=42,
318
322
  DB_TYPE_DEFAULT=127 // Must be last
319
323
};
369
373
#define HA_CREATE_USED_CONNECTION       (1L << 18)
370
374
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
371
375
#define HA_CREATE_USED_TRANSACTIONAL    (1L << 20)
 
376
#define HA_CREATE_USED_PAGE_CHECKSUM    (1L << 21)
372
377
 
373
378
typedef ulonglong my_xid; // this line is the same as in log_event.h
374
379
#define MYSQL_XID_PREFIX "MySQLXid"
757
762
};
758
763
 
759
764
 
 
765
inline LEX_STRING *hton_name(const handlerton *hton)
 
766
{
 
767
  return &(hton2plugin[hton->slot]->name);
 
768
}
 
769
 
 
770
 
760
771
/* Possible flags of a handlerton (there can be 32 of them) */
761
772
#define HTON_NO_FLAGS                 0
762
773
#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0)
808
819
  bool modified_non_trans_table;
809
820
 
810
821
  void reset() { no_2pc= FALSE; modified_non_trans_table= FALSE; }
 
822
  THD_TRANS() {}                        /* Remove gcc warning */
811
823
};
812
824
 
813
825
 
965
977
  bool frm_only;                        /* 1 if no ha_create_table() */
966
978
  bool varchar;                         /* 1 if table has a VARCHAR */
967
979
  enum ha_storage_media default_storage_media;  /* DEFAULT, DISK or MEMORY */
 
980
  enum ha_choice page_checksum;         /* If we have page_checksums */
968
981
} HA_CREATE_INFO;
969
982
 
970
983
typedef struct st_ha_alter_information
1048
1061
typedef struct st_ha_check_opt
1049
1062
{
1050
1063
  st_ha_check_opt() {}                        /* Remove gcc warning */
1051
 
  ulong sort_buffer_size;
1052
1064
  uint flags;       /* isam layer flags (e.g. for myisamchk) */
1053
1065
  uint sql_flags;   /* sql layer flags - for something myisamchk cannot do */
1054
 
  KEY_CACHE *key_cache; /* new key cache when changing key cache */
 
1066
  KEY_CACHE *key_cache; /* new key cache when changing key cache */
1055
1067
  void init();
1056
1068
} HA_CHECK_OPT;
1057
1069
 
1487
1499
    estimation_rows_to_insert= rows;
1488
1500
    start_bulk_insert(rows);
1489
1501
  }
1490
 
  int ha_end_bulk_insert()
 
1502
  int ha_end_bulk_insert(bool abort)
1491
1503
  {
1492
1504
    estimation_rows_to_insert= 0;
1493
 
    return end_bulk_insert();
 
1505
    return end_bulk_insert(abort);
1494
1506
  }
1495
1507
  int ha_bulk_update_row(const uchar *old_data, uchar *new_data,
1496
1508
                         uint *dup_key_found);
1514
1526
 
1515
1527
  int ha_change_partitions(HA_CREATE_INFO *create_info,
1516
1528
                           const char *path,
1517
 
                           ulonglong *copied,
1518
 
                           ulonglong *deleted,
 
1529
                           ulonglong * const copied,
 
1530
                           ulonglong * const deleted,
1519
1531
                           const uchar *pack_frm_data,
1520
1532
                           size_t pack_frm_len);
1521
1533
  int ha_drop_partitions(THD *thd, const char *path);
1721
1733
  virtual int rnd_pos_by_record(uchar *record);
1722
1734
  virtual int read_first_row(uchar *buf, uint primary_key);
1723
1735
  /**
1724
 
    The following function is only needed for tables that may be temporary
1725
 
    tables during joins.
 
1736
    The following 3 function is only needed for tables that may be
 
1737
    internal temporary tables during joins.
1726
1738
  */
1727
 
  virtual int restart_rnd_next(uchar *buf, uchar *pos)
 
1739
  virtual int remember_rnd_pos()
 
1740
    { return HA_ERR_WRONG_COMMAND; }
 
1741
  virtual int restart_rnd_next(uchar *buf)
1728
1742
    { return HA_ERR_WRONG_COMMAND; }
1729
1743
  virtual int rnd_same(uchar *buf, uint inx)
1730
1744
    { return HA_ERR_WRONG_COMMAND; }
1731
 
  virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key)
 
1745
 
 
1746
  virtual ha_rows records_in_range(uint inx, key_range *min_key,
 
1747
                                   key_range *max_key)
1732
1748
    { return (ha_rows) 10; }
1733
1749
  virtual void position(const uchar *record)=0;
1734
1750
  virtual int info(uint)=0; // see my_base.h for full description
1840
1856
  */
1841
1857
  virtual const char **bas_ext() const =0;
1842
1858
 
1843
 
  virtual int get_default_no_partitions(HA_CREATE_INFO *info) { return 1;}
 
1859
  virtual int get_default_no_partitions(HA_CREATE_INFO *create_info)
 
1860
  { return 1;}
1844
1861
  virtual void set_auto_partitions(partition_info *part_info) { return; }
1845
1862
  virtual bool get_no_parts(const char *name,
1846
1863
                            uint *no_parts)
1885
1902
  virtual bool is_crashed() const  { return 0; }
1886
1903
  virtual bool auto_repair() const { return 0; }
1887
1904
 
1888
 
 
1889
1905
#define CHF_CREATE_FLAG 0
1890
1906
#define CHF_DELETE_FLAG 1
1891
1907
#define CHF_RENAME_FLAG 2
1892
1908
 
1893
 
 
1894
1909
  /**
1895
1910
    @note lock_count() can return > 1 if the table is MERGE or partitioned.
1896
1911
  */
2115
2130
  */
2116
2131
  virtual void use_hidden_primary_key();
2117
2132
 
 
2133
  LEX_STRING *engine_name() { return hton_name(ht); }
2118
2134
  /**
2119
2135
    Lock table.
2120
2136
 
2253
2269
  virtual int repair(THD* thd, HA_CHECK_OPT* check_opt)
2254
2270
  { return HA_ADMIN_NOT_IMPLEMENTED; }
2255
2271
  virtual void start_bulk_insert(ha_rows rows) {}
2256
 
  virtual int end_bulk_insert() { return 0; }
 
2272
  virtual int end_bulk_insert(bool abort) { return 0; }
2257
2273
  virtual int index_read(uchar * buf, const uchar * key, uint key_len,
2258
2274
                         enum ha_rkey_function find_flag)
2259
2275
   { return  HA_ERR_WRONG_COMMAND; }
2282
2298
    This is called to delete all rows in a table
2283
2299
    If the handler don't support this, then this function will
2284
2300
    return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
2285
 
    by one.
 
2301
    by one. It should reset auto_increment if
 
2302
    thd->lex->sql_command == SQLCOM_TRUNCATE.
2286
2303
  */
2287
2304
  virtual int delete_all_rows()
2288
2305
  { return (my_errno=HA_ERR_WRONG_COMMAND); }
2313
2330
 
2314
2331
  virtual int change_partitions(HA_CREATE_INFO *create_info,
2315
2332
                                const char *path,
2316
 
                                ulonglong *copied,
2317
 
                                ulonglong *deleted,
 
2333
                                ulonglong * const copied,
 
2334
                                ulonglong * const deleted,
2318
2335
                                const uchar *pack_frm_data,
2319
2336
                                size_t pack_frm_len)
2320
2337
  { return HA_ERR_WRONG_COMMAND; }
2429
2446
 
2430
2447
static inline const char *ha_resolve_storage_engine_name(const handlerton *db_type)
2431
2448
{
2432
 
  return db_type == NULL ? "UNKNOWN" : hton2plugin[db_type->slot]->name.str;
 
2449
  return db_type == NULL ? "UNKNOWN" : hton_name(db_type)->str;
2433
2450
}
2434
2451
 
2435
2452
static inline bool ha_check_storage_engine_flag(const handlerton *db_type, uint32 flag)
2444
2461
}
2445
2462
 
2446
2463
/* basic stuff */
 
2464
int ha_init_errors(void);
2447
2465
int ha_init(void);
2448
2466
int ha_end(void);
2449
2467
int ha_initialize_handlerton(st_plugin_int *plugin);