diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2004-10-28 15:35:06 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2004-10-28 15:35:06 +0000 |
commit | 1aa81f3818023eaf95b46b795a7c4222850e46d1 (patch) | |
tree | 65a119e785c5cca9cf691d3cb15e41001f9d07b5 /sql/ha_ndbcluster.cc | |
parent | e3ac81bebf547b2031982134131ded3090cbe623 (diff) | |
download | mariadb-git-1aa81f3818023eaf95b46b795a7c4222850e46d1.tar.gz |
test that attribute name truncation works
exposed the attribute name size limit for handler
added field name truncation to ndb handler
mysql-test/t/ndb_basic.test:
test that attribute name truncation works
ndb/include/ndbapi/ndbapi_limits.h:
exposed the attribute name size limit for handler
sql/ha_ndbcluster.cc:
added field name truncation to ndb handler
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 044cb85b913..838cf69855a 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1393,8 +1393,13 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, // Set bound if not cancelled via type -1 if (p.bound_type != -1) - if (op->setBound(field->field_name, p.bound_type, p.bound_ptr)) + { + char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE]; + strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name)); + truncated_field_name[sizeof(truncated_field_name)-1]= '\0'; + if (op->setBound(truncated_field_name, p.bound_type, p.bound_ptr)) ERR_RETURN(op->getNdbError()); + } } } @@ -3102,7 +3107,12 @@ static int create_ndb_column(NDBCOL &col, HA_CREATE_INFO *info) { // Set name - col.setName(field->field_name); + { + char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE]; + strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name)); + truncated_field_name[sizeof(truncated_field_name)-1]= '\0'; + col.setName(truncated_field_name); + } // Get char set CHARSET_INFO *cs= field->charset(); // Set type and sizes @@ -3430,7 +3440,12 @@ int ha_ndbcluster::create_index(const char *name, { Field *field= key_part->field; DBUG_PRINT("info", ("attr: %s", field->field_name)); - ndb_index.addColumnName(field->field_name); + { + char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE]; + strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name)); + truncated_field_name[sizeof(truncated_field_name)-1]= '\0'; + ndb_index.addColumnName(truncated_field_name); + } } if (dict->createIndex(ndb_index)) |