diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2014-12-03 14:07:43 +0400 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-12-04 16:09:34 +0100 |
commit | c4cb15e87ba8cf4f1e7fd8e7cda5c88098ecd515 (patch) | |
tree | 042b437f82a3368aa8c9d5b3c894182f75ec93bf /sql/unireg.cc | |
parent | c4655cf862b24fe040280e38cb71d3b5d25f049b (diff) | |
download | mariadb-git-c4cb15e87ba8cf4f1e7fd8e7cda5c88098ecd515.tar.gz |
MDEV-60 Support for Spatial Reference systems for the GIS data.
The GEOMETRY field metadata is stored in the FRM file.
SRID for a spatial column now can be stored, it was added to the CREATE TABLE syntax,
so the AddGeometryData() stored procedure is now possible. Script adding the required Add/DropGeometryColumn sp-s added.
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r-- | sql/unireg.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc index 4087511bc49..7e4a64189d9 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -108,6 +108,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ulong key_buff_length; ulong filepos, data_offset; uint options_len; + uint gis_extra2_len= 0; uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE]; const partition_info *part_info= IF_PARTITIONING(thd->work_part_info, 0); int error; @@ -153,6 +154,9 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, options_len= engine_table_options_frm_length(create_info->option_list, create_fields, keys, key_info); +#ifdef HAVE_SPATIAL + gis_extra2_len= gis_field_options_image(NULL, create_fields); +#endif /*HAVE_SPATIAL*/ DBUG_PRINT("info", ("Options length: %u", options_len)); if (validate_comment_length(thd, &create_info->comment, TABLE_COMMENT_MAXLEN, @@ -197,6 +201,10 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, if (part_info) extra2_size+= 1 + 1 + hton_name(part_info->default_engine_type)->length; + if (gis_extra2_len) + extra2_size+= 1 + (gis_extra2_len > 255 ? 3 : 1) + gis_extra2_len; + + key_buff_length= uint4korr(fileinfo+47); frm.length= FRM_HEADER_SIZE; // fileinfo; @@ -241,6 +249,15 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, create_fields, keys, key_info); } +#ifdef HAVE_SPATIAL + if (gis_extra2_len) + { + *pos= EXTRA2_GIS; + pos= extra2_write_len(pos+1, gis_extra2_len); + pos+= gis_field_options_image(pos, create_fields); + } +#endif /*HAVE_SPATIAL*/ + int4store(pos, filepos); // end of the extra2 segment pos+= 4; @@ -913,7 +930,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, field->pack_flag, field->sql_type, field->charset, - field->geom_type, + field->geom_type, field->srid, field->unireg_check, field->save_interval ? field->save_interval : field->interval, |