You are here

function DB_pgsql::quoteSmart in Flickr API 5

Formats input so it can be safely used in a query

@since Method available since Release 1.6.0

Parameters

mixed $in the data to be formatted:

Return value

mixed the formatted data. The format depends on the input's PHP type: + null = the string <samp>NULL</samp> + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp> + integer or double = the unquoted number + other (including strings and numeric strings) = the data escaped according to MySQL's settings then encapsulated between single quotes

Overrides DB_common::quoteSmart

See also

DB_common::quoteSmart()

1 call to DB_pgsql::quoteSmart()
DB_pgsql::quote in phpFlickr/PEAR/DB/pgsql.php
@internal

File

phpFlickr/PEAR/DB/pgsql.php, line 492

Class

DB_pgsql
The methods PEAR DB uses to interact with PHP's pgsql extension for interacting with PostgreSQL databases

Code

function quoteSmart($in) {
  if (is_int($in) || is_double($in)) {
    return $in;
  }
  elseif (is_bool($in)) {
    return $in ? 'TRUE' : 'FALSE';
  }
  elseif (is_null($in)) {
    return 'NULL';
  }
  else {
    return "'" . $this
      ->escapeSimple($in) . "'";
  }
}