1. drupal
    1. 8
    2. 7
8 – 7 db_truncate($table, array $options = array())

Returns a new TruncateQuery object for the active database.


$table The table from which to delete.

$options An array of options to control how the query operates.

Return value

TruncateQuery A new TruncateQuery object for this connection.

Related topics

▾ 8 functions call db_truncate()

CommentActionsTestCase::clearWatchdog in modules/comment/comment.test
Helper function: clear the watchdog.
DatabaseDeleteTruncateTestCase::testTruncate in modules/simpletest/tests/database_test.test
Confirm that we can truncate a whole table successfully.
DatabaseTransactionTestCase::cleanUp in modules/simpletest/tests/database_test.test
Start over for a new test.
DrupalDatabaseCache::clear in includes/cache.inc
Expire data from the cache. If called without arguments, expirable entries will be cleared from the cache_page and cache_block bins.
MenuLinksUnitTestCase::createLinkHierarchy in modules/simpletest/tests/menu.test
Create a simple hierarchy of links.
StatisticsLoggingTestCase::setUp in modules/statistics/statistics.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
_menu_router_save in includes/menu.inc
Helper function to save data from menu_router_build() to the router table.
_update_cache_clear in modules/update/update.module
Invalidates cached data relating to update status.


includes/database/database.inc, line 2464

function db_truncate($table, array $options = array()) {
  if (empty($options['target']) || $options['target'] == 'slave') {
    $options['target'] = 'default';
  return Database::getConnection($options['target'])->truncate($table, $options);