Tests inserting data into an existing table.
$table: The database table to insert data into.
TRUE if the insert succeeded, FALSE otherwise.
function tryInsert($table = 'test_table') {
try {
db_insert($table)
->fields(array(
'id' => mt_rand(10, 20),
))
->execute();
return TRUE;
} catch (\Exception $e) {
return FALSE;
}
}