public function Connection::makeSequenceName in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::makeSequenceName()
Creates the appropriate sequence name for a given table and serial field.
This information is exposed to all database drivers, although it is only useful on some of them. This method is table prefix-aware.
Note that if a sequence was generated automatically by the database, its name might not match the one returned by this function. Therefore, in those cases, it is generally advised to use a database-specific way of retrieving the name of an auto-created sequence. For example, PostgreSQL provides a dedicated function for this purpose: pg_get_serial_sequence().
Parameters
string $table: The table name to use for the sequence.
string $field: The field name to use for the sequence.
Return value
string A table prefix-parsed string for the sequence name.
1 call to Connection::makeSequenceName()
- Connection::nextId in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Connection.php - Retrieve a the next id in a sequence.
File
- core/
lib/ Drupal/ Core/ Database/ Connection.php, line 498
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
public function makeSequenceName($table, $field) {
return $this
->prefixTables('{' . $table . '}_' . $field . '_seq');
}