13
13
along with this program; if not, write to the Free Software
14
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
#ifndef STORAGE_CSV_HA_TINA_H
17
#define STORAGE_CSV_HA_TINA_H
19
#include <drizzled/handler.h>
20
#include <mysys/thr_lock.h>
16
22
#include <sys/types.h>
17
23
#include <sys/stat.h>
18
24
#include "transparent_file.h"
28
34
typedef struct st_tina_share {
30
36
char data_file_name[FN_REFLEN];
31
uint table_name_length, use_count;
37
uint32_t table_name_length, use_count;
33
39
Here we save the length of the file for readers. This is updated by
34
40
inserts, updates and deletes. The var is initialized along with the
85
91
int init_data_file();
88
ha_tina(handlerton *hton, TABLE_SHARE *table_arg);
94
ha_tina(StorageEngine *engine, TableShare *table_arg);
96
102
const char *table_type(void) const { return "CSV"; }
97
const char *index_type(uint inx __attribute__((unused)))
103
const char *index_type(uint32_t)
98
104
{ return "NONE"; }
99
const char **bas_ext() const;
100
105
uint64_t table_flags() const
102
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
103
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE);
107
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT);
105
uint32_t index_flags(uint idx __attribute__((unused)),
106
uint part __attribute__((unused)),
107
bool all_parts __attribute__((unused))) const
109
uint32_t index_flags(uint32_t, uint32_t, bool) const
110
112
We will never have indexes so this will never be called(AKA we return
115
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
116
uint max_keys() const { return 0; }
117
uint max_key_parts() const { return 0; }
118
uint max_key_length() const { return 0; }
117
uint32_t max_record_length() const { return HA_MAX_REC_LENGTH; }
118
uint32_t max_keys() const { return 0; }
119
uint32_t max_key_parts() const { return 0; }
120
uint32_t max_key_length() const { return 0; }
120
122
Called in test_quick_select to determine if indexes should be used.
122
124
virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; }
123
125
/* The next method will never be called */
124
126
virtual bool fast_key_read() { return 1;}
126
128
TODO: return actual upper bound of number of records in the table.
127
129
(e.g. save number of records seen on full table scan and/or use file size
130
132
ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; }
132
int open(const char *name, int mode, uint open_options);
134
int open(const char *name, int mode, uint32_t open_options);
134
int write_row(uchar * buf);
135
int update_row(const uchar * old_data, uchar * new_data);
136
int delete_row(const uchar * buf);
136
int write_row(unsigned char * buf);
137
int update_row(const unsigned char * old_data, unsigned char * new_data);
138
int delete_row(const unsigned char * buf);
137
139
int rnd_init(bool scan=1);
138
int rnd_next(uchar *buf);
139
int rnd_pos(uchar * buf, uchar *pos);
140
bool check_and_repair(THD *thd);
141
int check(THD* thd, HA_CHECK_OPT* check_opt);
140
int rnd_next(unsigned char *buf);
141
int rnd_pos(unsigned char * buf, unsigned char *pos);
142
bool check_and_repair(Session *session);
143
int check(Session* session, HA_CHECK_OPT* check_opt);
142
144
bool is_crashed() const;
144
int repair(THD* thd, HA_CHECK_OPT* check_opt);
146
int repair(Session* session, HA_CHECK_OPT* check_opt);
145
147
/* This is required for SQL layer to know that we support autorepair */
146
148
bool auto_repair() const { return 1; }
147
void position(const uchar *record);
149
void position(const unsigned char *record);
149
151
int delete_all_rows(void);
150
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
151
bool check_if_incompatible_data(HA_CREATE_INFO *info,
154
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
153
THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
155
154
enum thr_lock_type lock_type);