function Connection::makeSequenceName
Same name in this branch
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::makeSequenceName()
Same name in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::makeSequenceName()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::makeSequenceName()
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\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.
Deprecated
in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement.
See also
https://www.drupal.org/node/3377046
File
-
core/
lib/ Drupal/ Core/ Database/ Connection.php, line 732
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
public function makeSequenceName($table, $field) {
@trigger_error(__METHOD__ . "() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3377046", E_USER_DEPRECATED);
$sequence_name = $this->prefixTables('{' . $table . '}_' . $field . '_seq');
// Remove identifier quotes as we are constructing a new name from a
// prefixed and quoted table name.
return str_replace($this->identifierQuotes, '', $sequence_name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.