?
avatar joaobsantos
joaobsantos
22 Sep 2015

Hi guys i was wondering if we could add the MySQL REPLACE command in the /libraries/joomla/database/query.php.

I've been trying to do so, unsuccessfully.

I've been trying to copy the SET to REPLACE to submit the code here...
For example in line 1383 we have a code to SET:

/**
 * Add a single condition string, or an array of strings to the SET clause of the query.
 *
 * Usage:
 * $query->set('a = 1')->set('b = 2');
 * $query->set(array('a = 1', 'b = 2');
 *
 * @param   mixed   $conditions  A string or array of string conditions.
 * @param   string  $glue        The glue by which to join the condition strings. Defaults to ,.
 *                               Note that the glue is set on first use and cannot be changed.
 *
 * @return  JDatabaseQuery  Returns this object to allow chaining.
 *
 * @since   11.1
 */
public function set($conditions, $glue = ',')
{
    if (is_null($this->set))
    {
        $glue = strtoupper($glue);
        $this->set = new JDatabaseQueryElement('SET', $conditions, "\n\t$glue ");
    }
    else
    {
        $this->set->append($conditions);
    }

    return $this;
}
avatar joaobsantos joaobsantos - open - 22 Sep 2015
avatar mbabker
mbabker - comment - 22 Sep 2015

PRs welcome. Just note that if you put it in the main JDatabaseQuery class it needs to be usable for all database drivers. If this is a MySQL specific thing, it needs to be placed in the MySQL query subclasses.

avatar joaobsantos
joaobsantos - comment - 22 Sep 2015

Ok tomorrow i'll try that... thx..

avatar joaobsantos
joaobsantos - comment - 23 Sep 2015

hi mbabker, this is what i've done - #7934

I've tested and it worked but i only start codeing 2 weeks ago and using github 3 days ago, this is my 1st commit, i dont know if it's well done...

avatar zero-24 zero-24 - change - 23 Sep 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 23 Sep 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-09-23 13:21:48
Closed_By zero-24
avatar zero-24 zero-24 - close - 23 Sep 2015
avatar zero-24 zero-24 - close - 23 Sep 2015
avatar zero-24 zero-24 - change - 23 Sep 2015
Category Libraries
avatar zero-24
zero-24 - comment - 23 Sep 2015

Closing as we have a Pull here: #7934 Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7932.

Add a Comment

Login with GitHub to post a comment