You are here

function _xmlsitemap_node_updatepid_query in XML sitemap 5

Build SQL query for updating pids in xmlsitemap_node table.

Return value

Query string

1 call to _xmlsitemap_node_updatepid_query()
xmlsitemap_node_enable in xmlsitemap_node/xmlsitemap_node.install
Implementation of hook_enable().

File

xmlsitemap_node/xmlsitemap_node.install, line 149

Code

function _xmlsitemap_node_updatepid_query() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $query = "\n        UPDATE {xmlsitemap_node} xn INNER JOIN {url_alias} ua\n        ON ua.src = CONCAT('node/', CAST(xn.nid AS CHAR))\n        SET xn.pid = ua.pid\n        WHERE xn.pid IS NULL\n      ";
      break;
    case 'pgsql':
      $query = "\n        UPDATE {xmlsitemap_node}\n        SET pid = {url_alias}.pid\n        FROM {url_alias}\n        WHERE {url_alias}.src = CONCAT('node/', CAST(nid AS VARCHAR)) AND {xmlsitemap_node}.pid IS NULL\n      ";
      break;
  }
  return $query;
}