diff options
author | apostle <vladkakurin007@gmail.com> | 2022-05-22 22:40:30 +0000 |
---|---|---|
committer | apostle <vladkakurin007@gmail.com> | 2022-05-22 22:47:09 +0000 |
commit | ba8b0a9c8d9d5b7545393c19e73e45ecd1819804 (patch) | |
tree | 22e3f516c0e03370e22be87f048269717c3ea6b9 | |
parent | af4225c8420d321d739d9fddef9a3350d1d5c03b (diff) | |
download | mariadb-git-ba8b0a9c8d9d5b7545393c19e73e45ecd1819804.tar.gz |
fix include and heap ptr
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 11 | ||||
-rw-r--r-- | storage/innobase/include/row0sel.h | 26 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.cc | 2 |
3 files changed, 34 insertions, 5 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 2722c9edeac..898604b9057 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -113,6 +113,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include "fil0pagecompress.h" #include "ut0mem.h" #include "row0ext.h" +#include "row0sel.h" #include "lz4.h" #include "lzo/lzo1x.h" @@ -9490,8 +9491,6 @@ ha_innobase::rnd_next( DBUG_RETURN(error); } -#include "../row/row0sel.cc" - int ha_innobase::sample_init() { @@ -9537,12 +9536,16 @@ ha_innobase::sample_next( mem_heap_t* heap= NULL; offsets= rec_get_offsets(rec, index, offsets, index->n_core_fields, ULINT_UNDEFINED, &heap); - ut_ad(offsets != NULL); - ut_ad(heap == NULL); + ut_ad(offsets); + res= row_sel_store_mysql_rec( buf, m_prebuilt, rec, NULL, true, index, offsets); + mtr.commit(); + + if(heap) + mem_heap_free(heap); return res ? 0 : HA_ERR_INTERNAL_ERROR; } diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h index eb83a4bcad6..ddff736a83f 100644 --- a/storage/innobase/include/row0sel.h +++ b/storage/innobase/include/row0sel.h @@ -480,3 +480,29 @@ row_sel_field_store_in_mysql_format_func( #include "row0sel.inl" #endif + +/** Convert a row in the Innobase format to a row in the MySQL format. +Note that the template in prebuilt may advise us to copy only a few +columns to mysql_rec, other columns are left blank. All columns may not +be needed in the query. +@param[out] mysql_rec row in the MySQL format +@param[in] prebuilt cursor +@param[in] rec Innobase record in the index + which was described in prebuilt's + template, or in the clustered index; + must be protected by a page latch +@param[in] vrow virtual columns +@param[in] rec_clust whether index must be the clustered index +@param[in] index index of rec +@param[in] offsets array returned by rec_get_offsets(rec) +@retval true on success +@retval false if not all columns could be retrieved */ +MY_ATTRIBUTE((warn_unused_result)) +bool row_sel_store_mysql_rec( + byte* mysql_rec, + row_prebuilt_t* prebuilt, + const rec_t* rec, + const dtuple_t* vrow, + bool rec_clust, + const dict_index_t* index, + const rec_offs* offsets); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index f208ca51d69..19d30bd3f3b 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -3092,7 +3092,7 @@ be needed in the query. @retval true on success @retval false if not all columns could be retrieved */ MY_ATTRIBUTE((warn_unused_result)) -static bool row_sel_store_mysql_rec( +bool row_sel_store_mysql_rec( byte* mysql_rec, row_prebuilt_t* prebuilt, const rec_t* rec, |