@@ -43,12 +43,13 @@ int create_key_row(std::string *response,
43
43
value_str,
44
44
tot_value_len,
45
45
num_value_rows,
46
+ prev_num_rows,
46
47
row_state,
47
48
&recAttr);
48
49
if (ret_code != 0 ) {
49
50
return ret_code;
50
51
}
51
- if (num_value_rows == 0 && prev_num_rows)
52
+ if (num_value_rows == 0 && prev_num_rows == 0 )
52
53
{
53
54
if (trans->execute (NdbTransaction::Commit,
54
55
NdbOperation::AbortOnError) == 0 &&
@@ -68,7 +69,7 @@ int create_key_row(std::string *response,
68
69
}
69
70
}
70
71
71
- if (trans->getNdbError ().code != FOREIGN_KEY_RESTRICT_ERROR )
72
+ if (trans->getNdbError ().code != RESTRICT_VALUE_ROWS_ERROR )
72
73
{
73
74
assign_ndb_err_to_response (response,
74
75
FAILED_EXEC_TXN,
@@ -88,23 +89,24 @@ int write_data_to_key_op(std::string *response,
88
89
const char *value_str,
89
90
Uint32 tot_value_len,
90
91
Uint32 num_value_rows,
92
+ Uint32 & prev_num_rows,
91
93
Uint32 row_state,
92
94
NdbRecAttr **recAttr) {
93
95
struct key_table key_row;
94
- const Uint32 mask = 0xEF ;
95
- const unsigned char *mask_ptr = (const unsigned char *)&mask;
96
+ Uint32 mask = 0xFF ;
96
97
key_row.null_bits = 0 ;
97
98
memcpy (&key_row.redis_key [2 ], key_str, key_len);
98
99
set_length (&key_row.redis_key [0 ], key_len);
99
100
key_row.redis_key_id = redis_key_id;
100
101
if (rondb_key == 0 )
101
102
{
102
- key_row. null_bits = 1 ;
103
+ mask = 0xFB ;
103
104
}
104
105
else
105
106
{
106
107
key_row.rondb_key = rondb_key;
107
108
}
109
+ const unsigned char *mask_ptr = (const unsigned char *)&mask;
108
110
key_row.tot_value_len = tot_value_len;
109
111
key_row.num_rows = num_value_rows;
110
112
key_row.value_data_type = row_state;
@@ -120,7 +122,14 @@ int write_data_to_key_op(std::string *response,
120
122
121
123
Uint32 code_buffer[64 ];
122
124
NdbInterpretedCode code (tab, &code_buffer[0 ], sizeof (code_buffer));
123
- int ret_code = write_key_row (response, code, tab);
125
+ int ret_code = 0 ;
126
+ if (num_value_rows > 0 || prev_num_rows > 0 ) {
127
+ ret_code = write_key_row_no_commit (response, code, tab);
128
+ }
129
+ else
130
+ {
131
+ ret_code = write_key_row_commit (response, code, tab);
132
+ }
124
133
if (ret_code != 0 ) {
125
134
return ret_code;
126
135
}
0 commit comments