function tryInsert($table = 'test_table') { try { db_insert($table) ->fields(array( 'id' => mt_rand(10, 20), )) ->execute(); return TRUE; } catch (Exception $e) { return FALSE; } }