diff options
author | unknown <mskold@mysql.com> | 2004-11-22 10:35:03 +0100 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2004-11-22 10:35:03 +0100 |
commit | 5672598f0af4548f09959552eec9d766a792fe09 (patch) | |
tree | 4b3d5b1082f5c6e2d15ba045d91240aa2e2225c7 /sql/ha_ndbcluster.cc | |
parent | 6d6b38c27fcac1da19a11fa07a5f02c2c22635fe (diff) | |
download | mariadb-git-5672598f0af4548f09959552eec9d766a792fe09.tar.gz |
Added checks for NOT NULL for all fields in UNIQUE INDEX (USING HASH)
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index bec4dfd9401..77cc7ce5bc4 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -796,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase) error= create_unique_index(unique_index_name, key_info); break; case UNIQUE_INDEX: - error= create_unique_index(unique_index_name, key_info); + if (!(error= check_index_fields_not_null(i))) + error= create_unique_index(unique_index_name, key_info); break; case ORDERED_INDEX: error= create_ordered_index(index_name, key_info); @@ -848,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const ORDERED_INDEX); } +int ha_ndbcluster::check_index_fields_not_null(uint inx) +{ + KEY* key_info= table->key_info + inx; + KEY_PART_INFO* key_part= key_info->key_part; + KEY_PART_INFO* end= key_part+key_info->key_parts; + DBUG_ENTER("check_index_fields_not_null"); + + for (; key_part != end; key_part++) + { + Field* field= key_part->field; + if (field->maybe_null()) + { + my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX), + MYF(0),field->field_name); + DBUG_RETURN(ER_NULL_COLUMN_IN_INDEX); + } + } + + DBUG_RETURN(0); +} void ha_ndbcluster::release_metadata() { |