summaryrefslogtreecommitdiff
path: root/sql/records.h
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-02-10 12:39:10 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-02-14 07:46:58 +0200
commitbdca350f59a62adfccc0f704efb5a3a34f0955ef (patch)
treed4d1cafcdcfe3ddab309583b295bae5693542dd2 /sql/records.h
parent5bf338435aae358b2661ce2dc04b5a70d3d0c783 (diff)
downloadmariadb-git-bdca350f59a62adfccc0f704efb5a3a34f0955ef.tar.gz
Allow READ_RECORD to make use of RAII and free itself on destruction
Diffstat (limited to 'sql/records.h')
-rw-r--r--sql/records.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/records.h b/sql/records.h
index 1928acfd4f4..473cb610be5 100644
--- a/sql/records.h
+++ b/sql/records.h
@@ -27,6 +27,10 @@ class SQL_SELECT;
class Copy_field;
class SORT_INFO;
+struct READ_RECORD;
+
+void end_read_record(READ_RECORD *info);
+
/**
A context for reading through a single table using a chosen access method:
index read, scan, etc, use of cache, etc.
@@ -73,7 +77,8 @@ struct READ_RECORD
Copy_field *copy_field;
Copy_field *copy_field_end;
public:
- READ_RECORD() {}
+ READ_RECORD() : table(NULL), cache(NULL) {}
+ ~READ_RECORD() { end_read_record(this); }
};
bool init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
@@ -82,7 +87,6 @@ bool init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
bool print_errors, bool disable_rr_cache);
bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
bool print_error, uint idx, bool reverse);
-void end_read_record(READ_RECORD *info);
void rr_unlock_row(st_join_table *tab);