function SchemaTest::tryUnsignedInsert
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php \Drupal\KernelTests\Core\Database\SchemaTest::tryUnsignedInsert()
Tries to insert a negative value into columns defined as unsigned.
Parameters
string $table_name: The table to insert.
string $column_name: The column to insert.
Return value
bool TRUE if the insert succeeded, FALSE otherwise.
1 call to SchemaTest::tryUnsignedInsert()
- SchemaTest::testUnsignedColumns in core/
tests/ Drupal/ KernelTests/ Core/ Database/ SchemaTest.php - Tests creating unsigned columns and data integrity thereof.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SchemaTest.php, line 574
Class
- SchemaTest
- Tests table creation and modification via the schema API.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function tryUnsignedInsert($table_name, $column_name) {
try {
$this->connection
->insert($table_name)
->fields([
$column_name => -1,
])
->execute();
return TRUE;
} catch (\Exception $e) {
return FALSE;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.