mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
SCRUM:
WL#1163 (Making spatial code optional) Pack of changes to do in sql/ code.
This commit is contained in:
@ -510,6 +510,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
blob_columns++;
|
||||
break;
|
||||
case FIELD_TYPE_GEOMETRY:
|
||||
#ifdef HAVE_SPATIAL
|
||||
if (!(file->table_flags() & HA_HAS_GEOMETRY))
|
||||
{
|
||||
my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED),
|
||||
@ -525,6 +526,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
sql_field->unireg_check=Field::BLOB_FIELD;
|
||||
blob_columns++;
|
||||
break;
|
||||
#else
|
||||
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED), MYF(0),
|
||||
"Spatial extentions", "HAVE_SPATIAL");
|
||||
DBUG_RETURN(-1);
|
||||
#endif /*HAVE_SPATIAL*/
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
case FIELD_TYPE_STRING:
|
||||
sql_field->pack_flag=0;
|
||||
@ -658,8 +664,14 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
key_info->flags = HA_FULLTEXT;
|
||||
break;
|
||||
case Key::SPATIAL:
|
||||
#ifdef HAVE_SPATIAL
|
||||
key_info->flags = HA_SPATIAL;
|
||||
break;
|
||||
#else
|
||||
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0),
|
||||
"Spatial extentions", "HAVE_SPATIAL");
|
||||
DBUG_RETURN(-1);
|
||||
#endif
|
||||
case Key::FOREIGN_KEY:
|
||||
key_number--; // Skip this key
|
||||
continue;
|
||||
@ -688,6 +700,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
checking for proper key parts number:
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
/* TODO: Add proper checks if handler supports key_type and algorithm */
|
||||
if (key_info->flags == HA_SPATIAL)
|
||||
{
|
||||
@ -698,8 +711,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
else if (key_info->algorithm == HA_KEY_ALG_RTREE)
|
||||
else
|
||||
#endif
|
||||
if (key_info->algorithm == HA_KEY_ALG_RTREE)
|
||||
{
|
||||
#ifdef HAVE_RTREE_KEYS
|
||||
if ((key_info->key_parts & 1) == 1)
|
||||
{
|
||||
my_printf_error(ER_WRONG_ARGUMENTS,
|
||||
@ -710,6 +726,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
my_printf_error(ER_NOT_SUPPORTED_YET, ER(ER_NOT_SUPPORTED_YET),
|
||||
MYF(0), "RTREE INDEX");
|
||||
DBUG_RETURN(-1);
|
||||
#else
|
||||
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0),
|
||||
"Spatial extentions", "HAVE_SPATIAL");
|
||||
DBUG_RETURN(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
List_iterator<key_part_spec> cols(key->columns);
|
||||
@ -779,6 +800,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_SPATIAL
|
||||
if (key->type == Key::SPATIAL)
|
||||
{
|
||||
if (!column->length )
|
||||
@ -790,6 +812,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
column->length=4*sizeof(double);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||
{
|
||||
if (key->type == Key::PRIMARY)
|
||||
@ -806,11 +829,13 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
MYF(0),column->field_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
#ifdef HAVE_SPATIAL
|
||||
if (key->type == Key::SPATIAL)
|
||||
{
|
||||
my_error(ER_SPATIAL_CANT_HAVE_NULL, MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
|
||||
{
|
||||
@ -834,9 +859,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_SPATIAL //TODO HF What's this for???
|
||||
else if (f_is_geom(sql_field->pack_flag))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
else if (column->length > length ||
|
||||
((f_is_packed(sql_field->pack_flag) ||
|
||||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
|
||||
|
Reference in New Issue
Block a user