0
I need to batch update a table, I have an object called $data
as the example below:
Array
(
[0] => stdClass Object
(
[nota] =>
[frequencia] =>
[temaTcc] =>
[idNotaFreq] => 3416a75f4cea9109507cacd8e2f2aefc
)
[1] => stdClass Object
(
[nota] =>
[frequencia] =>
[temaTcc] =>
[idNotaFreq] => a1d0c6e83f027327d8461063f4ac58a6
)
[2] => stdClass Object
(
[nota] =>
[frequencia] =>
[temaTcc] =>
[idNotaFreq] => 17e62166fc8586dfa4d1bc0e1742c08b
)
)
I’ll make the call on update_batch()
as follows:
return $this->db->update_batch($table, $data, 'md5(idNotaFreq)');
Error message I get:
One or more rows sent for batch update is missing the specified index(index).
Filename: C:/xampp/htdocs/cert_emissao/system/database/Db_query_builder.php Line Number: 2028
Note: In the example I left only 3 positions of the object, and I know that they are with some empty attributes, but I tried to fill all and even so persisted the problem. The objects I send to update
has between 10 and 14 positions in total, with a chance of some attributes being empty (as the example above) or can all be filled in. However, I always have the key filled in idNotaFreq
which I believe cannot be empty. The table name is nota_freq
(Mysql).
Are the values of this table mandatory? ie,
nota
and/orfrequencia
and/ortemaTcc
there is some rule in the bank that may or may not be recorded?– novic
None of the 3 are mandatory.
– Reginaldo Boeke
I was able to "solve" by making a change. I passed idNotaFreq in the WHERE clause on md5(). I removed md5() and it worked.
– Reginaldo Boeke
Does update_batch() not even work with md5(), or did I do it wrong? With update() md5() usage normally.
– Reginaldo Boeke