function SchemaTestCase::tryUnsignedInsert
7.x schema.test | SchemaTestCase::tryUnsignedInsert($table_name, $column_name) |
Tries to insert a negative value into columns defined as unsigned.
Parameters
$table_name: The table to insert
$column_name: The column to insert
Return value
TRUE if the insert succeeded, FALSE otherwise
1 call to SchemaTestCase::tryUnsignedInsert()
- SchemaTestCase::testUnsignedColumns in drupal-7.x/
modules/ simpletest/ tests/ schema.test - Tests creating unsigned columns and data integrity thereof.
File
- drupal-7.x/
modules/ simpletest/ tests/ schema.test, line 211 - Tests for the Database Schema API.
Class
- SchemaTestCase
- Unit tests for the Schema API.
Code
function tryUnsignedInsert($table_name, $column_name) {
try {
db_insert($table_name)
->fields(array($column_name => -1))
->execute();
return TRUE;
}
catch (Exception $e) {
return FALSE;
}
}