You are here

function views_join::db_safe in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 includes/handlers.inc \views_join::db_safe()

Ensure that input is db safe. We only check strings and ints tho so something that needs floats in their joins needs to do their own type checking.

1 call to views_join::db_safe()
views_join::join in includes/handlers.inc
Build the SQL for the join this object represents.

File

includes/handlers.inc, line 1380
handlers.inc Defines the various handler objects to help build and display views.

Class

views_join
A function class to represent a join and create the SQL necessary to implement the join.

Code

function db_safe($input, $info) {
  if (is_array($input)) {
    $output = array();
    foreach ($input as $value) {
      if (empty($info['numeric'])) {
        $output[] = db_escape_string($value);
      }
      else {
        $output[] = intval($value);
      }
    }
  }
  else {
    if (empty($info['numeric'])) {
      $output = db_escape_string($input);
    }
    else {
      $output = intval($input);
    }
  }
  return $output;
}