Cupara
Well-known member
Using a select statement with a where not in clause returns all data instead of data that does not match the not in clause.
Main cron function:
Model function:
The result is in the screenshot which is should return only one name I put in the database for testing purposes. I'm using var_dump() to get the result otherwise if I enable my delete statement it clears that table.
I'm not reporting an issue with an addon but an issue with a feature that should be built into XenForo from the Zend Framework. Using NOT IN doesn't return the correct results, instead it returns all results including those it should exclude.
The second screenshot shows the exact query I'm running and the result I'm expecting in var_dump().
Main cron function:
PHP:
$roster = json_decode($client, true);
$character = $roster['members'];
$c = array();
$rosterModel = XenForo_Model::create('xenWow_Model_Roster');
foreach($character AS $c)
{
$name[] = $c['character']['name'];
}
$names = implode(", ", $name);
$guildRoster = $rosterModel->getAllNonMatch($names);
Model function:
PHP:
public function getAllNonMatch($names)
{
return $this->_getDb()->fetchAll('SELECT char_id, char_name FROM xwow_roster WHERE char_name NOT IN('. $this->_getDb()->quote($names) .') ORDER BY char_name ASC');
}
The result is in the screenshot which is should return only one name I put in the database for testing purposes. I'm using var_dump() to get the result otherwise if I enable my delete statement it clears that table.
I'm not reporting an issue with an addon but an issue with a feature that should be built into XenForo from the Zend Framework. Using NOT IN doesn't return the correct results, instead it returns all results including those it should exclude.
The second screenshot shows the exact query I'm running and the result I'm expecting in var_dump().