function SchemaTestCase::tryInsert

1 call to SchemaTestCase::tryInsert()
SchemaTestCase::testSchema in modules/simpletest/tests/schema.test

File

modules/simpletest/tests/schema.test, line 140

Class

SchemaTestCase
Unit tests for the Schema API.

Code

function tryInsert($table = 'test_table') {
  try {
    db_insert($table)->fields(array(
      'id' => mt_rand(10, 20),
    ))
      ->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.