You are here

function xmlsitemap_placeholder in XML sitemap 5.2

Given a database field type, return the correct %-placeholder. Embed the placeholder in a query to be passed to db_query and and pass as an argument to db_query a value of the specified type. This is the backport of the function present in Drupal 6.

Parameters

$type: The type of a database field.

Return value

The placeholder string to embed in a query for that type.

1 call to xmlsitemap_placeholder()
xmlsitemap_placeholders in xmlsitemap/xmlsitemap.module
Generate placeholders for an array of query arguments of a single type. Given a database field type, return correct %-placeholders to embed in a query. This is the backport of a function present in Drupal 6.

File

xmlsitemap/xmlsitemap.module, line 357
Creates a sitemap compatible with the sitemaps.org schema.

Code

function xmlsitemap_placeholder($type) {
  switch ($type) {
    case 'varchar':
    case 'char':
    case 'text':
    case 'datetime':
      return "'%s'";
    case 'numeric':
      return '%n';
    case 'serial':
    case 'int':
      return '%d';
    case 'float':
      return '%f';
    case 'blob':
      return '%b';
  }
  return 'unsupported type ' . $type . 'for xmlsitemap_placeholder';
}