Function __global->filtercode_to_sql

Definitions

sources/filtercode.php

  • Convert some Filtercode filters into some SQL fragments.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$db object No No required parameter N/A N/A Database object to use
$filters ?array No No required parameter N/A N/A Parsed Filtercode structure (null: no filter)
$content_type ?ID_TEXT No No Null N/A N/A The content type (null: no function needed, direct in-table mapping always works)
$context ?string No No Null N/A N/A First parameter to send to the conversion function, may mean whatever that function wants it to. If we have no content type, this is the name of a table to read field metadata from (null: none)
$table_join_code string No No r N/A N/A What the database will join the table with

Returns

  • Tuple: array of extra join (implode with ''), string of extra where
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Convert some Filtercode filters into some SQL fragments.
 *
 * @param  object $db Database object to use
 * @param  ?array $filters Parsed Filtercode structure (null: no filter)
 * @param  ?ID_TEXT $content_type The content type (null: no function needed, direct in-table mapping always works)
 * @param  ?string $context First parameter to send to the conversion function, may mean whatever that function wants it to. If we have no content type, this is the name of a table to read field metadata from (null: none)
 * @param  string $table_join_code What the database will join the table with
 * @return array Tuple: array of extra join (implode with ''), string of extra where
 */

function filtercode_to_sql(object $db, ?array $filters, ?string $content_type = null, ?string $context = null, string $table_join_code = 'r') : array