summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-06-15 19:09:40 +0200
committerSergei Golubchik <sergii@pisem.net>2013-06-15 19:09:40 +0200
commit935817e985d15ce0d4f339ee7006ee891df11489 (patch)
tree0caaace72efcf645161c694ea2b1a190e56f9d6d /sql
parent68a6705ed1dc7a0ff5c86910e23989f97788e741 (diff)
downloadmariadb-git-935817e985d15ce0d4f339ee7006ee891df11489.tar.gz
Fix to compile without partitioning.
Remove few ifdef's
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_range.cc76
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/table.cc2
-rw-r--r--sql/unireg.cc13
4 files changed, 42 insertions, 51 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0373c582207..c6fbb579509 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3609,6 +3609,44 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond)
/****************************************************************************
* Partition pruning module
****************************************************************************/
+
+/*
+ Store field key image to table record
+
+ SYNOPSIS
+ store_key_image_to_rec()
+ field Field which key image should be stored
+ ptr Field value in key format
+ len Length of the value, in bytes
+
+ DESCRIPTION
+ Copy the field value from its key image to the table record. The source
+ is the value in key image format, occupying len bytes in buffer pointed
+ by ptr. The destination is table record, in "field value in table record"
+ format.
+*/
+
+void store_key_image_to_rec(Field *field, uchar *ptr, uint len)
+{
+ /* Do the same as print_key() does */
+ my_bitmap_map *old_map;
+
+ if (field->real_maybe_null())
+ {
+ if (*ptr)
+ {
+ field->set_null();
+ return;
+ }
+ field->set_notnull();
+ ptr++;
+ }
+ old_map= dbug_tmp_use_all_columns(field->table,
+ field->table->write_set);
+ field->set_key_image(ptr, len);
+ dbug_tmp_restore_column_map(field->table->write_set, old_map);
+}
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
@@ -3944,44 +3982,6 @@ end:
/*
- Store field key image to table record
-
- SYNOPSIS
- store_key_image_to_rec()
- field Field which key image should be stored
- ptr Field value in key format
- len Length of the value, in bytes
-
- DESCRIPTION
- Copy the field value from its key image to the table record. The source
- is the value in key image format, occupying len bytes in buffer pointed
- by ptr. The destination is table record, in "field value in table record"
- format.
-*/
-
-void store_key_image_to_rec(Field *field, uchar *ptr, uint len)
-{
- /* Do the same as print_key() does */
- my_bitmap_map *old_map;
-
- if (field->real_maybe_null())
- {
- if (*ptr)
- {
- field->set_null();
- return;
- }
- field->set_notnull();
- ptr++;
- }
- old_map= dbug_tmp_use_all_columns(field->table,
- field->table->write_set);
- field->set_key_image(ptr, len);
- dbug_tmp_restore_column_map(field->table->write_set, old_map);
-}
-
-
-/*
For SEL_ARG* array, store sel_arg->min values into table record buffer
SYNOPSIS
diff --git a/sql/opt_range.h b/sql/opt_range.h
index ddaa5c5e59a..ccddd40686c 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -1046,8 +1046,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond);
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond);
-void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
#endif
+void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
extern String null_string;
diff --git a/sql/table.cc b/sql/table.cc
index caed8ed4107..08903db93e1 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2125,7 +2125,7 @@ bool TABLE_SHARE::write_frm_image(const uchar *frm, size_t len)
bool TABLE_SHARE::read_frm_image(const uchar **frm, size_t *len)
{
- if (partition_info_str) // cannot discover a partition
+ if (IF_PARTITIONING(partition_info_str, 0)) // cannot discover a partition
{
DBUG_ASSERT(db_type()->discover_table == 0);
return 1;
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 0940b34308f..099f8ccbc78 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -72,9 +72,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
ulong filepos, data_offset;
uint options_len;
uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE];
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- partition_info *part_info= thd->work_part_info;
-#endif
+ const partition_info *part_info= IF_PARTITIONING(thd->work_part_info, 0);
int error;
uchar *frm_ptr, *pos;
LEX_CUSTRING frm= {0,0};
@@ -106,12 +104,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
=> Total 6 byte
*/
create_info->extra_size+= 6;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info)
- {
create_info->extra_size+= part_info->part_info_len;
- }
-#endif
for (i= 0; i < keys; i++)
{
@@ -266,13 +260,12 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
(create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info)
{
fileinfo[61]= (uchar) ha_legacy_type(part_info->default_engine_type);
DBUG_PRINT("info", ("part_db_type = %d", fileinfo[61]));
}
-#endif
+
int2store(fileinfo+59,db_file->extra_rec_buf_length());
memcpy(frm_ptr, fileinfo, FRM_HEADER_SIZE);
@@ -292,7 +285,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
memcpy(pos, str_db_type.str, str_db_type.length);
pos+= str_db_type.length;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info)
{
char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0;
@@ -303,7 +295,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
*pos++= auto_partitioned;
}
else
-#endif
{
pos+= 6;
}