~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/csv/ha_tina.h

  • Committer: Brian Aker
  • Date: 2008-07-13 22:21:51 UTC
  • Revision ID: brian@tangent.org-20080713222151-fv2tcpbsc829j2oc
Ulonglong to uint64_t

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include <sys/types.h>
17
17
#include <sys/stat.h>
 
18
#include <my_dir.h>
18
19
#include "transparent_file.h"
19
20
 
20
21
#define DEFAULT_CHAIN_LENGTH 512
28
29
typedef struct st_tina_share {
29
30
  char *table_name;
30
31
  char data_file_name[FN_REFLEN];
31
 
  uint32_t table_name_length, use_count;
 
32
  uint table_name_length, use_count;
 
33
  /*
 
34
    Below flag is needed to make log tables work with concurrent insert.
 
35
    For more details see comment to ha_tina::update_status.
 
36
  */
 
37
  my_bool is_log_table;
32
38
  /*
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
43
49
  File tina_write_filedes;  /* File handler for readers */
44
50
  bool crashed;             /* Meta file is crashed */
45
51
  ha_rows rows_recorded;    /* Number of rows in tables */
46
 
  uint32_t data_file_version;   /* Version of the data file used */
 
52
  uint data_file_version;   /* Version of the data file used */
47
53
} TINA_SHARE;
48
54
 
49
55
struct tina_set {
59
65
  off_t next_position;     /* Next position in the file scan */
60
66
  off_t local_saved_data_file_length; /* save position for reads */
61
67
  off_t temp_file_length;
62
 
  unsigned char byte_buffer[IO_SIZE];
 
68
  uchar byte_buffer[IO_SIZE];
63
69
  Transparent_file *file_buff;
64
70
  File data_file;                   /* File handler for readers */
65
71
  File update_temp_file;
72
78
  tina_set chain_buffer[DEFAULT_CHAIN_LENGTH];
73
79
  tina_set *chain;
74
80
  tina_set *chain_ptr;
75
 
  unsigned char chain_alloced;
76
 
  uint32_t chain_size;
77
 
  uint32_t local_data_file_version;  /* Saved version of the data file used */
 
81
  uchar chain_alloced;
 
82
  uint32 chain_size;
 
83
  uint local_data_file_version;  /* Saved version of the data file used */
78
84
  bool records_is_known;
79
85
  MEM_ROOT blobroot;
80
86
 
89
95
  ~ha_tina()
90
96
  {
91
97
    if (chain_alloced)
92
 
      free(chain);
 
98
      my_free(chain, 0);
93
99
    if (file_buff)
94
100
      delete file_buff;
95
101
  }
96
102
  const char *table_type(void) const { return "CSV"; }
97
 
  const char *index_type(uint32_t inx __attribute__((unused)))
 
103
  const char *index_type(uint inx __attribute__((__unused__)))
98
104
  { return "NONE"; }
99
105
  const char **bas_ext() const;
100
106
  uint64_t table_flags() const
102
108
    return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
103
109
            HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE);
104
110
  }
105
 
  uint32_t index_flags(uint32_t idx __attribute__((unused)),
106
 
                       uint32_t part __attribute__((unused)),
107
 
                       bool all_parts __attribute__((unused))) const
 
111
  uint32_t index_flags(uint idx __attribute__((__unused__)),
 
112
                       uint part __attribute__((__unused__)),
 
113
                       bool all_parts __attribute__((__unused__))) const
108
114
  {
109
115
    /*
110
116
      We will never have indexes so this will never be called(AKA we return
112
118
    */
113
119
    return 0;
114
120
  }
115
 
  uint32_t max_record_length() const { return HA_MAX_REC_LENGTH; }
116
 
  uint32_t max_keys()          const { return 0; }
117
 
  uint32_t max_key_parts()     const { return 0; }
118
 
  uint32_t max_key_length()    const { return 0; }
 
121
  uint max_record_length() const { return HA_MAX_REC_LENGTH; }
 
122
  uint max_keys()          const { return 0; }
 
123
  uint max_key_parts()     const { return 0; }
 
124
  uint max_key_length()    const { return 0; }
119
125
  /*
120
126
     Called in test_quick_select to determine if indexes should be used.
121
127
   */
129
135
  */
130
136
  ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; }
131
137
 
132
 
  int open(const char *name, int mode, uint32_t open_options);
 
138
  int open(const char *name, int mode, uint open_options);
133
139
  int close(void);
134
 
  int write_row(unsigned char * buf);
135
 
  int update_row(const unsigned char * old_data, unsigned char * new_data);
136
 
  int delete_row(const unsigned char * buf);
 
140
  int write_row(uchar * buf);
 
141
  int update_row(const uchar * old_data, uchar * new_data);
 
142
  int delete_row(const uchar * buf);
137
143
  int rnd_init(bool scan=1);
138
 
  int rnd_next(unsigned char *buf);
139
 
  int rnd_pos(unsigned char * buf, unsigned char *pos);
140
 
  bool check_and_repair(Session *session);
141
 
  int check(Session* session, HA_CHECK_OPT* check_opt);
 
144
  int rnd_next(uchar *buf);
 
145
  int rnd_pos(uchar * buf, uchar *pos);
 
146
  bool check_and_repair(THD *thd);
 
147
  int check(THD* thd, HA_CHECK_OPT* check_opt);
142
148
  bool is_crashed() const;
143
149
  int rnd_end();
144
 
  int repair(Session* session, HA_CHECK_OPT* check_opt);
 
150
  int repair(THD* thd, HA_CHECK_OPT* check_opt);
145
151
  /* This is required for SQL layer to know that we support autorepair */
146
152
  bool auto_repair() const { return 1; }
147
 
  void position(const unsigned char *record);
 
153
  void position(const uchar *record);
148
154
  int info(uint);
149
155
  int delete_all_rows(void);
150
 
  int create(const char *name, Table *form, HA_CREATE_INFO *create_info);
 
156
  int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
151
157
  bool check_if_incompatible_data(HA_CREATE_INFO *info,
152
 
                                  uint32_t table_changes);
 
158
                                  uint table_changes);
153
159
 
154
 
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
 
160
  THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
155
161
      enum thr_lock_type lock_type);
156
162
 
157
163
  /*
162
168
  void update_status();
163
169
 
164
170
  /* The following methods were added just for TINA */
165
 
  int encode_quote(unsigned char *buf);
166
 
  int find_current_row(unsigned char *buf);
 
171
  int encode_quote(uchar *buf);
 
172
  int find_current_row(uchar *buf);
167
173
  int chain_append();
168
174
};
169
175