Commit 9d8f968f authored by RenatoG's avatar RenatoG Committed by RenatoG

Issue #2912490 by RenatoG: Used db_delete() instead of delete queries with db_query()

parent 76b41cf3
......@@ -284,7 +284,9 @@ function hook_xmlsitemap_sitemap_operations() {
* The XML sitemap object that was deleted.
*/
function hook_xmlsitemap_sitemap_delete(stdClass $sitemap) {
db_query("DELETE FROM {mytable} WHERE smid = '%s'", $sitemap->smid);
db_delete('mytable')
->condition('smid', $sitemap->smid, '=')
->execute();
}
/**
......
......@@ -524,7 +524,8 @@ class XMLSitemapUnitTest extends XMLSitemapTestHelper {
$this->assertEqual(xmlsitemap_get_link_count(), 0);
// Delete all links. The chunk count should be 1 not 0.
db_query("DELETE FROM {xmlsitemap}");
db_delete('xmlsitemap')->execute();
$this->assertEqual(db_query("SELECT COUNT(id) FROM {xmlsitemap}")->fetchField(), 0);
$this->assertEqual(xmlsitemap_get_chunk_count(TRUE), 1);
}
......
......@@ -39,7 +39,7 @@ class XMLSitemapI18nWebTestCase extends XMLSitemapTestHelper {
variable_set('language_negotiation', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
// Create the two different language-context sitemaps.
db_query("DELETE FROM {xmlsitemap_sitemap}");
db_delete('xmlsitemap_sitemap')->execute();
$sitemap = new stdClass();
$sitemap->context = array('language' => 'en');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment