20
20
#ifndef DRIZZLED_CURSOR_H
21
21
#define DRIZZLED_CURSOR_H
23
#include <drizzled/atomics.h>
24
#include <drizzled/definitions.h>
23
#include <drizzled/xid.h>
25
24
#include <drizzled/discrete_interval.h>
26
#include <drizzled/error_t.h>
27
#include <drizzled/ha_statistics.h>
28
#include <drizzled/handler_structs.h>
29
25
#include <drizzled/identifier.h>
26
#include <drizzled/definitions.h>
30
27
#include <drizzled/key_map.h>
31
#include <drizzled/message/table.h>
29
/* Definitions for parameters to do with Cursor-routines */
31
#include <drizzled/thr_lock.h>
32
#include <drizzled/sql_string.h>
32
33
#include <drizzled/sql_list.h>
33
#include <drizzled/thr_lock.h>
34
#include <drizzled/xid.h>
34
#include <drizzled/plugin/storage_engine.h>
35
#include <drizzled/handler_structs.h>
36
#include <drizzled/ha_statistics.h>
37
#include <drizzled/atomics.h>
39
#include <drizzled/message/table.pb.h>
37
42
#include <algorithm>
39
#include <drizzled/visibility.h>
232
232
/* ha_ methods: pubilc wrappers for private virtual API */
234
int ha_open(const identifier::Table &identifier, int mode, int test_if_locked);
234
int ha_open(const TableIdentifier &identifier, int mode, int test_if_locked);
235
235
int startIndexScan(uint32_t idx, bool sorted) __attribute__ ((warn_unused_result));
236
236
int endIndexScan();
237
237
int startTableScan(bool scan) __attribute__ ((warn_unused_result));
273
273
/* Estimates calculation */
274
274
virtual double scan_time(void)
275
{ return static_cast<double>(stats.data_file_length) / IO_SIZE + 2; }
275
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
276
276
virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows)
277
{ return ranges + rows; }
277
{ return rows2double(ranges+rows); }
279
279
virtual double index_only_read_time(uint32_t keynr, double records);
526
526
virtual int open(const char *, int , uint32_t ) { assert(0); return -1; }
527
virtual int doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked);
527
virtual int doOpen(const TableIdentifier &identifier, int mode, uint32_t test_if_locked);
528
528
virtual int doStartIndexScan(uint32_t idx, bool)
529
529
{ active_index= idx; return 0; }
530
530
virtual int doEndIndexScan() { active_index= MAX_KEY; return 0; }
665
665
int *timestamps, int *timestamps_with_niladic);
667
667
bool create_table(Session *session,
668
const identifier::Table &identifier,
669
HA_CREATE_INFO *create_info,
670
message::Table &table_proto,
671
AlterInfo *alter_info,
672
bool tmp_table, uint32_t select_field_count,
673
bool is_if_not_exists);
668
const TableIdentifier &identifier,
669
HA_CREATE_INFO *create_info,
670
message::Table &table_proto,
671
AlterInfo *alter_info,
672
bool tmp_table, uint32_t select_field_count,
673
bool is_if_not_exists);
675
675
bool create_table_no_lock(Session *session,
676
const identifier::Table &identifier,
677
HA_CREATE_INFO *create_info,
678
message::Table &table_proto,
679
AlterInfo *alter_info,
680
bool tmp_table, uint32_t select_field_count,
681
bool is_if_not_exists);
676
const TableIdentifier &identifier,
677
HA_CREATE_INFO *create_info,
678
message::Table &table_proto,
679
AlterInfo *alter_info,
680
bool tmp_table, uint32_t select_field_count,
681
bool is_if_not_exists);
683
683
bool create_like_table(Session* session,
684
identifier::Table::const_reference destination_identifier,
685
identifier::Table::const_reference source_identifier,
686
message::Table &create_table_proto,
687
bool is_if_not_exists,
684
const TableIdentifier &destination_identifier,
685
TableList* table, TableList* src_table,
686
message::Table &create_table_proto,
687
bool is_if_not_exists,
690
690
bool rename_table(Session &session,
691
691
plugin::StorageEngine *base,
692
const identifier::Table &old_identifier,
693
const identifier::Table &new_identifier);
692
const TableIdentifier &old_identifier,
693
const TableIdentifier &new_identifier);
695
695
bool prepare_update(Session *session, TableList *table_list,
696
696
Item **conds, uint32_t order_num, Order *order);
723
723
void close_handle_and_leave_table_as_lock(Table *table);
724
724
bool wait_for_tables(Session *session);
725
725
bool table_is_used(Table *table, bool wait_for_name_lock);
726
Table *drop_locked_tables(Session *session, const drizzled::identifier::Table &identifier);
727
void abort_locked_tables(Session *session, const drizzled::identifier::Table &identifier);
726
Table *drop_locked_tables(Session *session, const drizzled::TableIdentifier &identifier);
727
void abort_locked_tables(Session *session, const drizzled::TableIdentifier &identifier);
728
728
extern Field *not_found_field;
729
729
extern Field *view_ref_found;