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

Returns a new InsertQuery object for the active database.


$table The table into which to insert.

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

Return value

InsertQuery A new InsertQuery object for this connection.

Related topics

▾ 143 functions call db_insert()

actions_synchronize in includes/actions.inc
Synchronizes actions that are provided by modules in hook_action_info().
aggregator_categorize_items_submit in modules/aggregator/aggregator.pages.inc
Process aggregator_categorize_items() form submissions.
aggregator_save_category in modules/aggregator/aggregator.module
Add/edit/delete aggregator categories.
aggregator_save_feed in modules/aggregator/aggregator.module
Add/edit/delete an aggregator feed.
aggregator_save_item in modules/aggregator/aggregator.processor.inc
Add/edit/delete an aggregator item.
batch_process in includes/form.inc
Processes the batch.
block_add_block_form_submit in modules/block/block.admin.inc
Form submission handler for the add block form.
block_admin_configure_submit in modules/block/block.admin.inc
Form submission handler for the block configuration form.
block_update_7004 in modules/block/block.install
Add new blocks to new regions, migrate custom variables to blocks.
CategorizeFeedItemTestCase::testCategorizeFeedItem in modules/aggregator/aggregator.test
If a feed has a category, make sure that the children inherit that categorization.
comment_enable in modules/comment/comment.install
Implements hook_enable().
comment_node_insert in modules/comment/comment.module
Implements hook_node_insert().
comment_update_7006 in modules/comment/comment.install
Migrate data from the comment field to field storage.
contact_install in modules/contact/contact.install
Implements hook_install().
DatabaseBasicSyntaxTestCase::testLikeBackslash in modules/simpletest/tests/database_test.test
Test LIKE query containing a backslash.
DatabaseBasicSyntaxTestCase::testLikeEscape in modules/simpletest/tests/database_test.test
Test escaping of LIKE wildcards.
DatabaseInsertDefaultsTestCase::testDefaultEmptyInsert in modules/simpletest/tests/database_test.test
Test that no action will be preformed if no fields are specified.
DatabaseInsertDefaultsTestCase::testDefaultInsert in modules/simpletest/tests/database_test.test
Test that we can run a query that is "default values for everything".
DatabaseInsertDefaultsTestCase::testDefaultInsertWithFields in modules/simpletest/tests/database_test.test
Test that we can insert fields with values and defaults in the same query.
DatabaseInsertLOBTestCase::testInsertMultipleBlob in modules/simpletest/tests/database_test.test
Test that we can insert multiple blob fields in the same query.
DatabaseInsertLOBTestCase::testInsertOneBlob in modules/simpletest/tests/database_test.test
Test that we can insert a single blob field successfully.
DatabaseInsertTestCase::testInsertFieldOnlyDefinintion in modules/simpletest/tests/database_test.test
Test that we can specify fields without values and specify values later.
DatabaseInsertTestCase::testInsertLastInsertID in modules/simpletest/tests/database_test.test
Test that inserts return the proper auto-increment ID.
DatabaseInsertTestCase::testInsertSelect in modules/simpletest/tests/database_test.test
Test that the INSERT INTO ... SELECT ... syntax works.
DatabaseInsertTestCase::testMultiInsert in modules/simpletest/tests/database_test.test
Test that we can insert multiple records in one query object.
DatabaseInsertTestCase::testRepeatedInsert in modules/simpletest/tests/database_test.test
Test that an insert object can be reused with new data after it executes.
DatabaseInsertTestCase::testSimpleInsert in modules/simpletest/tests/database_test.test
Test the very basic insert functionality.
DatabaseInvalidDataTestCase::testInsertDuplicateData in modules/simpletest/tests/database_test.test
Traditional SQL database systems abort inserts when invalid data is encountered.
DatabaseRegressionTestCase::testRegression_310447 in modules/simpletest/tests/database_test.test
Regression test for #310447.
DatabaseSelectSubqueryTestCase::testExistsSubquerySelect in modules/simpletest/tests/database_test.test
Test EXISTS subquery conditionals on SELECT statements.
DatabaseSelectSubqueryTestCase::testNotExistsSubquerySelect in modules/simpletest/tests/database_test.test
Test NOT EXISTS subquery conditionals on SELECT statements.
DatabaseSelectTestCase::testRandomOrder in modules/simpletest/tests/database_test.test
Test that random ordering of queries works.
DatabaseTestCase::addSampleData in modules/simpletest/tests/database_test.test
Setup our sample data.
DatabaseTestCase::ensureSampleDataNull in modules/simpletest/tests/database_test.test
Set up tables for NULL handling.
DatabaseTransactionTestCase::insertRow in modules/simpletest/tests/database_test.test
Insert a single row into the testing table.
DatabaseTransactionTestCase::transactionInnerLayer in modules/simpletest/tests/database_test.test
Helper method for transaction unit tests. This "inner layer" transaction is either used alone or nested inside of the "outer layer" transaction.
DatabaseTransactionTestCase::transactionOuterLayer in modules/simpletest/tests/database_test.test
Helper method for transaction unit test. This "outer layer" transaction starts and then encapsulates the "inner layer" transaction. This nesting is used to evaluate whether the the database transaction API properly supports…
DatabaseUpdateLOBTestCase::testUpdateMultipleBlob in modules/simpletest/tests/database_test.test
Confirm that we can update two blob columns in the same table.
DatabaseUpdateLOBTestCase::testUpdateOneBlob in modules/simpletest/tests/database_test.test
Confirm that we can update a blob column.
dbtng_example_entry_insert in examples/dbtng_example/dbtng_example.module
Save an entry in the database.
dbtng_example_install in examples/dbtng_example/dbtng_example.install
Implements hook_install().
DrupalTestCase::insertAssert in modules/simpletest/drupal_web_test_case.php
Store an assertion from outside the testing context.
drupal_install_system in includes/install.inc
Callback to install the system module.
drupal_write_record in includes/common.inc
Saves (inserts or updates) a record to the database based upon the schema.
FieldSqlStorageTestCase::testFieldAttachLoad in modules/field/modules/field_sql_storage/field_sql_storage.test
Uses the mysql tables and records to verify field_load_revision works correctly.
FieldSqlStorageTestCase::testFieldAttachSaveMissingData in modules/field/modules/field_sql_storage/field_sql_storage.test
Tests insert and update with missing or NULL fields.
field_sql_storage_field_storage_write in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_write().
FileUsageTest::testGetUsage in modules/simpletest/tests/file.test
Tests file_usage_list().
FileUsageTest::testRemoveUsage in modules/simpletest/tests/file.test
Tests file_usage_delete().
FilterFormatUpgradePathTestCase::testFilterFormatUpgrade in modules/simpletest/tests/upgrade/upgrade.filter.test
Test a successful upgrade.
filter_update_7001 in modules/filter/filter.install
Break out "escape HTML filter" option to its own filter.
filter_update_7003 in modules/filter/filter.install
Upgrade the {filter} table for core filters.
filter_update_7005 in modules/filter/filter.install
Integrate text formats with the user permissions system.
flood_register_event in includes/common.inc
Register an event for the current visitor to the flood control mechanism.
forum_field_storage_pre_insert in modules/forum/forum.module
Implements hook_field_storage_pre_insert().
forum_field_storage_pre_update in modules/forum/forum.module
Implements hook_field_storage_pre_update().
forum_node_insert in modules/forum/forum.module
Implements hook_node_insert().
forum_node_update in modules/forum/forum.module
Implements hook_node_update().
forum_update_7001 in modules/forum/forum.install
Create new {forum_index} table.
hook_entity_insert in modules/system/system.api.php
Act on entities when inserted.
hook_field_insert in modules/field/field.api.php
Define custom insert behavior for this module's field types.
hook_field_storage_pre_insert in modules/field/field.api.php
Act before the storage backends insert field data.
hook_field_storage_pre_update in modules/field/field.api.php
Act before the storage backends update field data.
hook_field_storage_write in modules/field/field.api.php
Write field data for an entity.
hook_field_update in modules/field/field.api.php
Define custom update behavior for this module's field types.
hook_insert in modules/node/node.api.php
Respond to creation of a new node.
hook_install in modules/system/system.api.php
Perform setup tasks when the module is installed.
hook_node_insert in modules/node/node.api.php
Respond to creation of a new node.
hook_path_insert in modules/path/path.api.php
Allow modules to respond to a path being inserted.
hook_taxonomy_term_insert in modules/taxonomy/taxonomy.api.php
Act on taxonomy terms when inserted.
hook_taxonomy_term_update in modules/taxonomy/taxonomy.api.php
Act on taxonomy terms when updated.
hook_user_insert in modules/user/user.api.php
A user account was created.
hook_user_logout in modules/user/user.api.php
The user just logged out.
hook_user_role_insert in modules/user/user.api.php
Inform other modules that a user role has been added.
hook_user_update in modules/user/user.api.php
A user account was updated.
ImportOPMLTestCase::openImportForm in modules/aggregator/aggregator.test
Open OPML import form.
ImportOPMLTestCase::submitImportForm in modules/aggregator/aggregator.test
Submit form with invalid, empty and valid OPML files.
locale in modules/locale/locale.module
Provides interface translation services.
locale_add_language in includes/locale.inc
API function to add a language.
locale_install in modules/locale/locale.install
Implements hook_install().
locale_translate_edit_form_submit in modules/locale/locale.admin.inc
Process string editing form submissions.
lock_acquire in includes/lock.inc
Acquire (or renew) a lock, but do not block if it fails.
menu_link_save in includes/menu.inc
Saves a menu link.
minimal_install in profiles/minimal/minimal.install
Implements hook_install().
nodeapi_example_node_insert in examples/nodeapi_example/nodeapi_example.module
Implements hook_node_insert().
node_access_example_node_insert in examples/node_access_example/node_access_example.module
Implements hook_node_insert().
node_access_rebuild in modules/node/node.module
Rebuild the node access database. This is occasionally needed by modules that make system-wide changes to access levels.
node_access_write_grants in modules/node/node.module
Writes a list of grants to the database, deleting any previously saved ones.
node_form_block_admin_configure_submit in modules/node/node.module
Form submit handler for block configuration form.
node_install in modules/node/node.install
Implements hook_install().
node_type_save in modules/node/node.module
Saves a node type to the database.
openid_association in modules/openid/openid.module
Attempt to create a shared secret with the OpenID Provider.
openid_user_identities in modules/openid/openid.pages.inc
Menu callback; Manage OpenID identities for the specified user.
openid_verify_assertion_nonce in modules/openid/openid.module
Verify that the nonce has not been used in earlier assertions from the same OpenID provider.
poll_insert in modules/poll/poll.module
Implements hook_insert().
poll_vote in modules/poll/poll.module
Submit handler for processing a vote.
profile_field_form_submit in modules/profile/profile.admin.inc
Process profile_field_form submissions.
RegistryParseFilesTestCase::setUp in modules/simpletest/tests/registry.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.…
SchemaTestCase::assertFieldAdditionRemoval in modules/simpletest/tests/schema.test
Assert that a given field can be added and removed from a table.
SchemaTestCase::assertFieldCharacteristics in modules/simpletest/tests/schema.test
Assert that a newly added field has the correct characteristics.
SchemaTestCase::tryInsert in modules/simpletest/tests/schema.test
SchemaTestCase::tryUnsignedInsert in modules/simpletest/tests/schema.test
Tries to insert a negative value into columns defined as unsigned.
search_index in modules/search/search.module
Update the full-text search index for a particular item.
simpletest_run_tests in modules/simpletest/simpletest.module
Actually runs tests.
standard_install in profiles/standard/standard.install
Implements hook_install().
StatisticsTestCase::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.…
statistics_exit in modules/statistics/statistics.module
Implements hook_exit().
SystemQueue::createItem in modules/system/system.queue.inc
system_block_ip_action in modules/system/system.module
Blocks the current user's IP address.
system_ip_blocking_form_submit in modules/system/system.admin.inc
system_update_7003 in modules/system/system.install
Update {blocked_ips} with valid IP addresses from {access}.
system_update_7007 in modules/system/system.install
Convert to new method of storing permissions.
system_update_7011 in modules/system/system.install
Split the 'bypass node access' permission from 'administer nodes'.
system_update_7029 in modules/system/system.install
Add new 'view own unpublished content' permission for authenticated users. Preserves legacy behavior from Drupal 6.x.
system_update_7036 in modules/system/system.install
Split the 'access site in maintenance mode' permission from 'administer site configuration'.
system_update_7053 in modules/system/system.install
Upgrade standard blocks and menus.
system_update_7061 in modules/system/system.install
Migrate upload.module data to the newly created file field.
system_update_files_database in modules/system/system.module
Updates the records in the system table based on the files array.
tablesort_example_install in examples/tablesort_example/tablesort_example.install
Implements hook_install().
taxonomy_field_insert in modules/taxonomy/taxonomy.module
Implements hook_field_insert().
taxonomy_field_update in modules/taxonomy/taxonomy.module
Implements hook_field_update().
taxonomy_term_save in modules/taxonomy/taxonomy.module
Saves a term object to the database.
taxonomy_test_taxonomy_term_insert in modules/simpletest/tests/taxonomy_test.module
Implements hook_taxonomy_term_insert().
taxonomy_update_7005 in modules/taxonomy/taxonomy.install
Migrate {taxonomy_term_node} table to field storage.
tracker_cron in modules/tracker/tracker.module
Implements hook_cron().
trigger_assign_form_submit in modules/trigger/trigger.admin.inc
Submit function for trigger_assign_form().
update_fix_d7_install_profile in includes/update.inc
Register the currently installed profile in the system table.
update_fix_d7_requirements in includes/update.inc
Perform Drupal 6.x to 7.x updates that are required for update.php to function properly.
UpgradePathTestCase::variable_set in modules/simpletest/tests/upgrade/upgrade.test
Specialized variable_set() that works even if the child site is not upgraded.
UrlAlterFunctionalTest::testUrlAlter in modules/simpletest/tests/path.test
Test that URL altering works and that it occurs in the correct order.
UserBlocksUnitTests::insertSession in modules/user/user.test
Insert a user session into the {sessions} table. This function is used since we cannot log in more than one user at the same time in tests.
user_install in modules/user/user.install
Implements hook_install().
user_save in modules/user/user.module
Save changes to a user account or add a new user.
_book_update_outline in modules/book/book.module
Common helper function to handles additions and updates to the book outline.
_locale_import_one_string_db in includes/locale.inc
Import one string into the database.
_locale_parse_js_file in includes/locale.inc
Parses a JavaScript file, extracts strings wrapped in Drupal.t() and Drupal.formatPlural() and inserts them into the database.
_menu_router_save in includes/menu.inc
Helper function to save data from menu_router_build() to the router table.
_openid_invalid_openid_transition in modules/openid/openid.inc
Provides transition for accounts with possibly invalid OpenID identifiers in authmap.
_registry_parse_file in includes/registry.inc
Parse a file and save its function and class listings.
_update_7000_field_create_field in modules/field/field.install
Utility function: create a field by writing directly to the database.
_update_7000_field_create_instance in modules/field/field.install
Utility function: write a field instance directly to the database.
_update_7000_field_sql_storage_write in modules/field/modules/field_sql_storage/field_sql_storage.install
Utility function: write field data directly to SQL storage.
_update_create_fetch_task in modules/update/update.fetch.inc
Add a task to the queue for fetching release history data for a project.


includes/database/database.inc, line 2392

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