You are here

function DatabaseInsertLOBTestCase::testInsertMultipleBlob in Drupal 7

Test that we can insert multiple blob fields in the same query.

File

modules/simpletest/tests/database_test.test, line 689

Class

DatabaseInsertLOBTestCase
Insert tests using LOB fields, which are weird on some databases.

Code

function testInsertMultipleBlob() {
  $id = db_insert('test_two_blobs')
    ->fields(array(
    'blob1' => 'This is',
    'blob2' => 'a test',
  ))
    ->execute();
  $r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(
    ':id' => $id,
  ))
    ->fetchAssoc();
  $this
    ->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', 'Can insert multiple blobs per row.');
}