comparison core/lib/Drupal/Core/Database/Connection.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
477 * Creates the appropriate sequence name for a given table and serial field. 477 * Creates the appropriate sequence name for a given table and serial field.
478 * 478 *
479 * This information is exposed to all database drivers, although it is only 479 * This information is exposed to all database drivers, although it is only
480 * useful on some of them. This method is table prefix-aware. 480 * useful on some of them. This method is table prefix-aware.
481 * 481 *
482 * Note that if a sequence was generated automatically by the database, its
483 * name might not match the one returned by this function. Therefore, in those
484 * cases, it is generally advised to use a database-specific way of retrieving
485 * the name of an auto-created sequence. For example, PostgreSQL provides a
486 * dedicated function for this purpose: pg_get_serial_sequence().
487 *
482 * @param string $table 488 * @param string $table
483 * The table name to use for the sequence. 489 * The table name to use for the sequence.
484 * @param string $field 490 * @param string $field
485 * The field name to use for the sequence. 491 * The field name to use for the sequence.
486 * 492 *
522 * query comment. The comment strings in this example are separated by a 528 * query comment. The comment strings in this example are separated by a
523 * space to avoid PHP parse errors. 529 * space to avoid PHP parse errors.
524 * 530 *
525 * For example, the comment: 531 * For example, the comment:
526 * @code 532 * @code
527 * db_update('example') 533 * \Drupal::database()->update('example')
528 * ->condition('id', $id) 534 * ->condition('id', $id)
529 * ->fields(array('field2' => 10)) 535 * ->fields(array('field2' => 10))
530 * ->comment('Exploit * / DROP TABLE node; --') 536 * ->comment('Exploit * / DROP TABLE node; --')
531 * ->execute() 537 * ->execute()
532 * @endcode 538 * @endcode
1026 * For example, the following does a case-insensitive query for all rows whose 1032 * For example, the following does a case-insensitive query for all rows whose
1027 * name starts with $prefix: 1033 * name starts with $prefix:
1028 * @code 1034 * @code
1029 * $result = db_query( 1035 * $result = db_query(
1030 * 'SELECT * FROM person WHERE name LIKE :pattern', 1036 * 'SELECT * FROM person WHERE name LIKE :pattern',
1031 * array(':pattern' => db_like($prefix) . '%') 1037 * array(':pattern' => $injected_connection->escapeLike($prefix) . '%')
1032 * ); 1038 * );
1033 * @endcode 1039 * @endcode
1034 * 1040 *
1035 * Backslash is defined as escape character for LIKE patterns in 1041 * Backslash is defined as escape character for LIKE patterns in
1036 * Drupal\Core\Database\Query\Condition::mapConditionOperator(). 1042 * Drupal\Core\Database\Query\Condition::mapConditionOperator().