summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormskold@mysql.com <>2004-08-13 13:51:18 +0200
committermskold@mysql.com <>2004-08-13 13:51:18 +0200
commit7c6b884ef5d2007b96cd538f42d5b7e9ae7a53b6 (patch)
tree377d74e888b2ddaaeae15b47803bc328f3fe4ae3 /sql
parenta454b977d2d4c9a92e4aa0f3232f4088f3e2de2b (diff)
downloadmariadb-git-7c6b884ef5d2007b96cd538f42d5b7e9ae7a53b6.tar.gz
Added support for NULL in unique index
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index b6db9b96308..702be862328 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1040,11 +1040,11 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
bounds[bound],
field->field_name));
DBUG_DUMP("key", (char*)key_ptr, field_len);
-
+
if (op->setBound(field->field_name,
bound,
- key_ptr,
- field_len) != 0)
+ field->is_null() ? 0 : key_ptr,
+ field->is_null() ? 0 : field_len) != 0)
ERR_RETURN(op->getNdbError());
key_ptr+= field_len;
@@ -1293,8 +1293,6 @@ int ha_ndbcluster::write_row(byte *record)
update_timestamp(record+table->timestamp_default_now-1);
has_auto_increment= (table->next_number_field && record == table->record[0]);
skip_auto_increment= table->auto_increment_field_not_null;
- if ((has_auto_increment) && (!skip_auto_increment))
- update_auto_increment();
if (!(op= trans->getNdbOperation(m_tabname)))
ERR_RETURN(trans->getNdbError());
@@ -1313,6 +1311,10 @@ int ha_ndbcluster::write_row(byte *record)
else
{
int res;
+
+ if ((has_auto_increment) && (!skip_auto_increment))
+ update_auto_increment();
+
if ((res= set_primary_key(op)))
return res;
}
@@ -1323,7 +1325,10 @@ int ha_ndbcluster::write_row(byte *record)
Field *field= table->field[i];
if (!(field->flags & PRI_KEY_FLAG) &&
set_ndb_value(op, field, i))
+ {
+ skip_auto_increment= true;
ERR_RETURN(op->getNdbError());
+ }
}
/*
@@ -1345,7 +1350,10 @@ int ha_ndbcluster::write_row(byte *record)
(int)rows_inserted, (int)bulk_insert_rows));
bulk_insert_not_flushed= false;
if (trans->execute(NoCommit) != 0)
+ {
+ skip_auto_increment= true;
DBUG_RETURN(ndb_err(trans));
+ }
}
if ((has_auto_increment) && (skip_auto_increment))
{
@@ -3068,6 +3076,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_ndb(NULL),
m_table(NULL),
m_table_flags(HA_REC_NOT_IN_SEQ |
+ //HA_NULL_IN_KEY |
HA_NOT_EXACT_COUNT |
HA_NO_PREFIX_CHAR_KEYS),
m_use_write(false),