Function DatabaseConnector->prefer_index

Definitions

sources/database.php

  • Get extra SQL for marking an index preferred within a query. Output should be appended after table name within a query (basically).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$table ID_TEXT No No required parameter N/A N/A The table name
$index ID_TEXT No No required parameter N/A N/A The index name
$do_check_first boolean No No True N/A N/A Check the index actually exists first (sometimes we add new indexes in patch releases for performance reasons, but referencing them would cause a fatal error)

Returns

  • SQL to add
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get extra SQL for marking an index preferred within a query. Output should be appended after table name within a query (basically).
 *
 * @param  ID_TEXT $table The table name
 * @param  ID_TEXT $index The index name
 * @param  boolean $do_check_first Check the index actually exists first (sometimes we add new indexes in patch releases for performance reasons, but referencing them would cause a fatal error)
 * @return string SQL to add
 */

public function prefer_index(string $table, string $index, bool $do_check_first = true) : string