User tests: Successful: Unsuccessful:
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();
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
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 ?
Ya, from that aspect I'd say you're right. I'd use the concatenate method as an example here.
So i should use the concatenate method as an a example and make a REPLACE one?!
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-02-15 20:24:10 |
Closed_By | ⇒ | joaobsantos |
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).