? Success

User tests: Successful: Unsuccessful:

avatar joaobsantos
joaobsantos
23 Sep 2015

For example if i want to turn off help menu in joomla backend i´ll do something like this:

//Replacing a Record

$db = JFactory::getDbo();

$query = $db->getQuery(true);


$query->update($db->quoteName('#__modules'))

      ->set($db->quoteName('params'))

      ->replace('(`params`, \'showhelp\":\"1\', \'showhelp\":\"0\')')

      ->where('id' ."=" .'12');


$db->setQuery($query);

$result = $db->execute();
avatar joaobsantos joaobsantos - open - 23 Sep 2015
avatar joaobsantos joaobsantos - change - 23 Sep 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Sep 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 23 Sep 2015

Since it isn't MySQL specific syntax, the method's doc block shouldn't state that (otherwise it should be moved to the MySQL query subclasses, which after a quick search PostgreSQL and SQL Server use the same structure for REPLACE). Also, the method needs a full doc block to pass our tests (you can use the one from set as a starting point).

avatar joaobsantos
joaobsantos - comment - 23 Sep 2015

Ok @mbabker i´ll try my best to fulfill you're requirements, it took my all morning to do this, just started programming 2 weeks ago... Do u think this is a good add-on for the code or not really?!

avatar zero-24 zero-24 - change - 23 Sep 2015
Category Libraries
avatar alikon
alikon - comment - 23 Sep 2015

i'm viewing this by sql perspective,
the replace() is a function and not a query element like SET

for example this sql is "legal"

select replace(field, 'oldstring', 'newstring'), fieldb,...
from table
where ....

so i'm not sure
JDatabaseQueryElement is the best place ?

avatar mbabker
mbabker - comment - 23 Sep 2015

Ya, from that aspect I'd say you're right. I'd use the concatenate method as an example here.

avatar joaobsantos
joaobsantos - comment - 23 Sep 2015

So i should use the concatenate method as an a example and make a REPLACE one?!

avatar joaobsantos joaobsantos - change - 15 Feb 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-02-15 20:24:10
Closed_By joaobsantos
avatar joaobsantos joaobsantos - close - 15 Feb 2016
avatar joaobsantos joaobsantos - close - 15 Feb 2016

Add a Comment

Login with GitHub to post a comment