Hi at all,this is my first post on this group, so excuse me for any error of any kind :)I'm developing an app using Joomla! Platform 12.1 and i need to use IGNORE clause for a set of multiple insert.Actually, the framework doesn't support the use of this clause, but, reading the code, it seems quite simple to add it.If i'm not wrong it could be sufficient to edit the method insert of the JDatabaseQuery class (joomla/database/query.php).Now the function is this:public function insert($table, $incrementField=false)
{
$this->type = 'insert';
$this->insert = new JDatabaseQueryElement('INSERT INTO', $table);
$this->autoIncrementField = $incrementField;return $this;
}I think (but i could be wrong! I don't yet fully know the logic of the entire database package) that the function could be rewrote in this way:
public function insert($table, $incrementField=false, $ignore=false)
{
$this->type = 'insert';
if($ignore)
{
$this->insert = new JDatabaseQueryElement('INSERT IGNORE INTO', $table);
}
else
{
$this->insert = new JDatabaseQueryElement('INSERT INTO', $table);
}$this->autoIncrementField = $incrementField;
return $this;
}What do you think about?
$this->_dbo->setQuery(str_replace('INSERT INTO', 'INSERT IGNORE INTO', $query));
public function insertIgnore($table)
{
$this->type = 'insert';
$this->insert = new JDatabaseQueryElement('INSERT IGNORE INTO', $table);
return $this;
}
It seems work well: the query is correctly built but i think, if interested in, that someone else should try it.