summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorjoreland@mysql.com <>2004-08-15 18:58:02 +0200
committerjoreland@mysql.com <>2004-08-15 18:58:02 +0200
commite51de97ebea490e342b06faf0e66f5e3197b64bf (patch)
treeac7b2b6a4aea8fc0703c91b78d32e75d85f00a5c /sql
parent2fb2ee6f8fa2cf32479f4e5b539986b54ebc0cdd (diff)
parent9f053d642662584c875ebe5c8932be5da992e1a4 (diff)
downloadmariadb-git-e51de97ebea490e342b06faf0e66f5e3197b64bf.tar.gz
Merge mysql.com:/home/jonas/src/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1-ndb
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),