| 5 database.inc | db_query($query) |
| 6 database.mysql-common.inc | db_query($query) |
| 6 database.pgsql.inc | db_query($query) |
| 7 database.inc | db_query($query, array $args = array(), array $options = array()) |
| 8 database.inc | db_query($query, array $args = array(), array $options = array()) |
Executes an arbitrary query string against the active database.
Use this function for SELECT queries if it is just a simple query string. If the caller or other modules need to change the query, use db_select() instead.
Do not use this function for INSERT, UPDATE, or DELETE queries. Those should be handled via db_insert(), db_update() and db_delete() respectively.
Parameters
$query: The prepared statement query to run. Although it will accept both named and unnamed placeholders, named placeholders are strongly preferred as they are more self-documenting.
$args: An array of values to substitute into the query. If the query uses named placeholders, this is an associative array in any order. If the query uses unnamed placeholders (?), this is an indexed array and the order must match the order of placeholders in the query string.
$options: An array of options to control how the query operates.
Return value
DatabaseStatementInterface A prepared statement object, already executed.
See also
DatabaseConnection::defaultOptions()
Related topics
- Database abstraction layer
- Allow the use of different database servers using the same code base.
▾ 436 functions call db_query()
- ActionLoopTestCase::triggerActions in modules/
simpletest/ tests/ actions.test - Create an infinite loop by causing a watchdog message to be set, which causes the actions to be triggered again, up to actions_max_stack times.
- ActionsConfigurationTestCase::testActionConfiguration in modules/
simpletest/ tests/ actions.test - Test the configuration of advanced actions through the administration interface.
- actions_do in includes/
actions.inc - Performs a given list of actions by executing their callback functions.
- actions_function_lookup in includes/
actions.inc - Returns an action array key (function or ID), given its hash.
- actions_get_all_actions in includes/
actions.inc - Retrieves all action instances from the database.
- actions_load in includes/
actions.inc - Retrieves a single action from the database.
- actions_synchronize in includes/
actions.inc - Synchronizes actions that are provided by modules in hook_action_info().
- AggregatorCronTestCase::testCron in modules/
aggregator/ aggregator.test - Add feeds update them on cron.
- AggregatorTestCase::createFeed in modules/
aggregator/ aggregator.test - Create an aggregator feed (simulate form submission on admin/config/services/aggregator/add/feed).
- AggregatorTestCase::getCategories in modules/
aggregator/ aggregator.test - Pull categories from aggregator_category table.
- AggregatorTestCase::getFeedCategories in modules/
aggregator/ aggregator.test - Pull feed categories from aggregator_category_feed table.
- AggregatorTestCase::uniqueFeed in modules/
aggregator/ aggregator.test - Check if the feed name and url is unique.
- AggregatorTestCase::updateAndRemove in modules/
aggregator/ aggregator.test - Add and remove feed items and ensure that the count is zero.
- AggregatorTestCase::updateFeedItems in modules/
aggregator/ aggregator.test - Update feed items (simulate click to admin/config/services/aggregator/update/$fid).
- aggregator_aggregator_process in modules/
aggregator/ aggregator.processor.inc - Implements hook_aggregator_process().
- aggregator_aggregator_remove in modules/
aggregator/ aggregator.processor.inc - Implements hook_aggregator_remove().
- aggregator_block_configure in modules/
aggregator/ aggregator.module - Implements hook_block_configure().
- aggregator_block_info in modules/
aggregator/ aggregator.module - Implements hook_block_info().
- aggregator_block_view in modules/
aggregator/ aggregator.module - Implements hook_block_view().
- aggregator_categorize_items in modules/
aggregator/ aggregator.pages.inc - Form constructor to build the page list form.
- aggregator_category_load in modules/
aggregator/ aggregator.module - Loads an aggregator category.
- aggregator_cron in modules/
aggregator/ aggregator.module - Implements hook_cron().
- aggregator_expire in modules/
aggregator/ aggregator.processor.inc - Expires items from a feed depending on expiration settings.
- aggregator_feed_items_load in modules/
aggregator/ aggregator.pages.inc - Loads and optionally filters feed items.
- aggregator_feed_load in modules/
aggregator/ aggregator.module - Loads an aggregator feed.
- aggregator_form_category_validate in modules/
aggregator/ aggregator.admin.inc - Form validation handler for aggregator_form_category().
- aggregator_form_feed in modules/
aggregator/ aggregator.admin.inc - Form constructor for adding and editing feed sources.
- aggregator_form_feed_validate in modules/
aggregator/ aggregator.admin.inc - Form validation handler for aggregator_form_feed().
- aggregator_form_opml in modules/
aggregator/ aggregator.admin.inc - Form constructor for importing feeds from OPML.
- aggregator_form_opml_submit in modules/
aggregator/ aggregator.admin.inc - Form submission handler for aggregator_form_opml().
- aggregator_page_categories in modules/
aggregator/ aggregator.pages.inc - Menu callback; displays all the categories used by the aggregator.
- aggregator_page_opml in modules/
aggregator/ aggregator.pages.inc - Menu callback; generates an OPML representation of all feeds.
- aggregator_page_rss in modules/
aggregator/ aggregator.pages.inc - Menu callback; generate an RSS 0.92 feed of aggregator items or categories.
- aggregator_page_sources in modules/
aggregator/ aggregator.pages.inc - Menu callback; displays all the feeds used by the aggregator.
- aggregator_save_feed in modules/
aggregator/ aggregator.module - Add/edit/delete an aggregator feed.
- aggregator_save_item in modules/
aggregator/ aggregator.processor.inc - Adds/edits/deletes an aggregator item.
- aggregator_view in modules/
aggregator/ aggregator.admin.inc - Displays the aggregator administration page.
- BasicMinimalUpdatePath::testBasicMinimalUpdate in modules/
simpletest/ tests/ upgrade/ upgrade.test - Tests a successful point release update.
- BasicStandardUpdatePath::testBasicStandardUpdate in modules/
simpletest/ tests/ upgrade/ upgrade.test - Tests a successful point release update.
- BasicUpgradePath::testBasicUpgrade in modules/
simpletest/ tests/ upgrade/ upgrade.test - Test a successful upgrade.
- BatchQueue::getAllItems in includes/
batch.queue.inc - Retrieves all remaining items in the queue.
- batch_load in includes/
batch.inc - Loads a batch from the database.
- BlockCacheTestCase::setCacheMode in modules/
block/ block.test - Private helper method to set the test block's cache mode.
- blocked_ip_load in modules/
system/ system.module - Retrieve a blocked IP address from the database.
- BlockTestCase::testBlock in modules/
block/ block.test - Test configuring and moving a module-define block to specific regions.
- BlockTestCase::testBlockRehash in modules/
block/ block.test - Test _block_rehash().
- BlockTestCase::testBlockVisibility in modules/
block/ block.test - Test block visibility.
- BlockTestCase::testBlockVisibilityListedEmpty in modules/
block/ block.test - Test block visibility when using "pages" restriction but leaving "pages" textarea empty
- BlockTestCase::testBlockVisibilityPerUser in modules/
block/ block.test - Test user customization of block visibility.
- BlockTestCase::testCustomBlock in modules/
block/ block.test - Test creating custom block, moving it to a specific region and then deleting it.
- BlockTestCase::testCustomBlockFormat in modules/
block/ block.test - Test creating custom block using Full HTML.
- block_admin_configure in modules/
block/ block.admin.inc - Form constructor for the block configuration form.
- block_block_info in modules/
block/ block.module - Implements hook_block_info().
- block_block_list_alter in modules/
block/ block.module - Implements hook_block_list_alter().
- block_block_view in modules/
block/ block.module - Implements hook_block_view().
- block_custom_block_get in modules/
block/ block.module - Returns information from database about a user-created (custom) block.
- block_flush_caches in modules/
block/ block.module - Implements hook_flush_caches().
- block_form_user_profile_form_alter in modules/
block/ block.module - Implements hook_form_FORM_ID_alter() for user_profile_form().
- block_load in modules/
block/ block.module - Loads a block object from the database.
- block_theme_initialize in modules/
block/ block.module - Assigns an initial, default set of blocks for a theme.
- block_update_7004 in modules/
block/ block.install - Add new blocks to new regions, migrate custom variables to blocks.
- block_update_7005 in modules/
block/ block.install - Update the {block_custom}.format column.
- book_get_books in modules/
book/ book.module - Returns an array of all books.
- book_link_load in modules/
book/ book.module - Like menu_link_load(), but adds additional data from the {book} table.
- book_node_delete in modules/
book/ book.module - Implements hook_node_delete().
- book_node_load in modules/
book/ book.module - Implements hook_node_load().
- CategorizeFeedItemTestCase::testCategorizeFeedItem in modules/
aggregator/ aggregator.test - If a feed has a category, make sure that the children inherit that categorization.
- CategorizeFeedTestCase::testCategorizeFeed in modules/
aggregator/ aggregator.test - Create a feed and make sure you can add more than one category to it.
- color_update_7001 in modules/
color/ color.install - Warn site administrator if unsafe CSS color codes are found in the database.
- CommentInterfaceTest::setEnvironment in modules/
comment/ comment.test - Re-configures the environment, module settings, and user permissions.
- comment_count_unpublished in modules/
comment/ comment.module - Returns a menu title which includes the number of unapproved comments.
- comment_delete_multiple in modules/
comment/ comment.module - Delete comments and all their replies.
- comment_form_node_form_alter in modules/
comment/ comment.module - Implements hook_form_BASE_FORM_ID_alter().
- comment_multiple_delete_confirm in modules/
comment/ comment.admin.inc - List the selected comments and verify that the admin wants to delete them.
- comment_new_page_count in modules/
comment/ comment.module - Calculate page number for first new comment.
- comment_node_delete in modules/
comment/ comment.module - Implements hook_node_delete().
- comment_node_load in modules/
comment/ comment.module - Implements hook_node_load().
- comment_node_search_result in modules/
comment/ comment.module - Implements hook_node_search_result().
- comment_node_update_index in modules/
comment/ comment.module - Implements hook_node_update_index().
- comment_num_new in modules/
comment/ comment.module - Get number of new comments for current user and specified node.
- comment_publish_action in modules/
comment/ comment.module - Publishes a comment.
- comment_reply in modules/
comment/ comment.pages.inc - This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
- comment_save in modules/
comment/ comment.module - Accepts a submission of new or changed comment content.
- comment_unpublish_action in modules/
comment/ comment.module - Unpublishes a comment.
- comment_update_7001 in modules/
comment/ comment.install - Change comment status from published being 0 to being 1
- comment_update_7003 in modules/
comment/ comment.install - Split {comment}.timestamp into 'created' and 'changed', improve indexing on {comment}.
- comment_update_7006 in modules/
comment/ comment.install - Migrate data from the comment field to field storage.
- comment_update_index in modules/
comment/ comment.module - Implements hook_update_index().
- comment_user_delete in modules/
comment/ comment.module - Implements hook_user_delete().
- ContactPersonalTestCase::testPersonalContactFlood in modules/
contact/ contact.test - Tests the personal contact form flood protection.
- ContactSitewideTestCase::deleteCategories in modules/
contact/ contact.test - Deletes all categories.
- ContactSitewideTestCase::getCategories in modules/
contact/ contact.test - Gets a list of all category IDs.
- ContactSitewideTestCase::testSiteWideContact in modules/
contact/ contact.test - Tests configuration options and the site-wide contact form.
- contact_site_form in modules/
contact/ contact.pages.inc - Form constructor for the site-wide contact form.
- dashboard_show_block_content in modules/
dashboard/ dashboard.module - Ajax callback to display the rendered contents of a specific block.
- DatabaseBasicSyntaxTestCase::testBasicConcat in modules/
simpletest/ tests/ database_test.test - Test for string concatenation.
- DatabaseBasicSyntaxTestCase::testFieldConcat in modules/
simpletest/ tests/ database_test.test - Test for string concatenation with field values.
- DatabaseDeleteTruncateTestCase::testSimpleDelete in modules/
simpletest/ tests/ database_test.test - Confirm that we can delete a single record successfully.
- DatabaseDeleteTruncateTestCase::testSubselectDelete in modules/
simpletest/ tests/ database_test.test - Confirm that we can use a subselect in a delete successfully.
- DatabaseDeleteTruncateTestCase::testTruncate in modules/
simpletest/ tests/ database_test.test - Confirm that we can truncate a whole table successfully.
- DatabaseFetch2TestCase::testQueryFetchBoth in modules/
simpletest/ tests/ database_test.test - Confirm that we can fetch a record into a doubly-keyed array explicitly.
- DatabaseFetch2TestCase::testQueryFetchCol in modules/
simpletest/ tests/ database_test.test - Confirm that we can fetch an entire column of a result set at once.
- DatabaseFetch2TestCase::testQueryFetchNum in modules/
simpletest/ tests/ database_test.test - DatabaseFetchTestCase::testQueryFetchArray in modules/
simpletest/ tests/ database_test.test - Confirm that we can fetch a record to an array associative explicitly.
- DatabaseFetchTestCase::testQueryFetchClass in modules/
simpletest/ tests/ database_test.test - Confirm that we can fetch a record into a new instance of a custom class.
- DatabaseFetchTestCase::testQueryFetchDefault in modules/
simpletest/ tests/ database_test.test - Confirm that we can fetch a record properly in default object mode.
- DatabaseFetchTestCase::testQueryFetchObject in modules/
simpletest/ tests/ database_test.test - Confirm that we can fetch a record to an object explicitly.
- 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::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.
- DatabaseLoggingTestCase::testEnableLogging in modules/
simpletest/ tests/ database_test.test - Test that we can log the existence of a query.
- DatabaseLoggingTestCase::testEnableMultiConnectionLogging in modules/
simpletest/ tests/ database_test.test - Test that we can log queries separately on different connections.
- DatabaseLoggingTestCase::testEnableMultiLogging in modules/
simpletest/ tests/ database_test.test - Test that we can run two logs in parallel.
- DatabaseLoggingTestCase::testEnableTargetLogging in modules/
simpletest/ tests/ database_test.test - Test that we can log queries against multiple targets on the same connection.
- DatabaseLoggingTestCase::testEnableTargetLoggingNoTarget in modules/
simpletest/ tests/ database_test.test - Test that logs to separate targets collapse to the same connection properly.
- DatabaseMergeTestCase::testMergeInsert in modules/
simpletest/ tests/ database_test.test - Confirm that we can merge-insert a record successfully.
- DatabaseMergeTestCase::testMergeInsertWithoutUpdate in modules/
simpletest/ tests/ database_test.test - Test that we can merge-insert without any update fields.
- DatabaseMergeTestCase::testMergeUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can merge-update a record successfully.
- DatabaseMergeTestCase::testMergeUpdateExcept in modules/
simpletest/ tests/ database_test.test - Confirm that we can merge-update a record successfully, with different insert and update.
- DatabaseMergeTestCase::testMergeUpdateExplicit in modules/
simpletest/ tests/ database_test.test - Confirm that we can merge-update a record successfully, with alternate replacement.
- DatabaseMergeTestCase::testMergeUpdateExpression in modules/
simpletest/ tests/ database_test.test - Confirm that we can merge-update a record successfully, with expressions.
- DatabaseMergeTestCase::testMergeUpdateWithoutUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can merge-update without any update fields.
- DatabaseQueryTestCase::testArraySubstitution in modules/
simpletest/ tests/ database_test.test - Test that we can specify an array of values in the query by simply passing in an array.
- DatabaseRangeQueryTestCase::testRangeQuery in modules/
simpletest/ tests/ database_test.test - Confirm that range query work and return correct result.
- DatabaseRegressionTestCase::testRegression_310447 in modules/
simpletest/ tests/ database_test.test - Regression test for #310447.
- DatabaseSchema_sqlite::findTables in includes/
database/ sqlite/ schema.inc - Find all tables that are like the specified base table name.
- DatabaseSelectPagerDefaultTestCase::testEvenPagerQuery in modules/
simpletest/ tests/ database_test.test - Confirm that a pager query returns the correct results.
- DatabaseSelectPagerDefaultTestCase::testOddPagerQuery in modules/
simpletest/ tests/ database_test.test - Confirm that a pager query returns the correct results.
- DatabaseSelectTestCase::testRandomOrder in modules/
simpletest/ tests/ database_test.test - Test that random ordering of queries works.
- DatabaseTasks::runTestQuery in includes/
install.inc - Run SQL tests to ensure the database can execute commands with the current user.
- DatabaseTasks_pgsql::checkBinaryOutput in includes/
database/ pgsql/ install.inc - Check Binary Output.
- DatabaseTasks_pgsql::checkBinaryOutputSuccess in includes/
database/ pgsql/ install.inc - Verify that a binary data roundtrip returns the original string.
- DatabaseTasks_pgsql::checkEncoding in includes/
database/ pgsql/ install.inc - Check encoding is UTF8.
- DatabaseTasks_pgsql::initializeDatabase in includes/
database/ pgsql/ install.inc - Make PostgreSQL Drupal friendly.
- DatabaseTransactionTestCase::assertRowAbsent in modules/
simpletest/ tests/ database_test.test - Assert that a given row is absent from the test table.
- DatabaseTransactionTestCase::assertRowPresent in modules/
simpletest/ tests/ database_test.test - Assert that a given row is present in the test table.
- DatabaseTransactionTestCase::testCommittedTransaction in modules/
simpletest/ tests/ database_test.test - Test committed transaction.
- DatabaseTransactionTestCase::testTransactionRollBackNotSupported in modules/
simpletest/ tests/ database_test.test - Test transaction rollback on a database that does not support transactions.
- DatabaseTransactionTestCase::testTransactionRollBackSupported in modules/
simpletest/ tests/ database_test.test - Test transaction rollback on a database that supports transactions.
- DatabaseUpdateComplexTestCase::testBetweenConditionUpdate in modules/
simpletest/ tests/ database_test.test - Test BETWEEN conditional clauses.
- DatabaseUpdateComplexTestCase::testInConditionUpdate in modules/
simpletest/ tests/ database_test.test - Test WHERE IN clauses.
- DatabaseUpdateComplexTestCase::testLikeConditionUpdate in modules/
simpletest/ tests/ database_test.test - Test LIKE conditionals.
- DatabaseUpdateComplexTestCase::testNotInConditionUpdate in modules/
simpletest/ tests/ database_test.test - Test WHERE NOT IN clauses.
- DatabaseUpdateComplexTestCase::testOrConditionUpdate in modules/
simpletest/ tests/ database_test.test - Test updates with OR conditionals.
- DatabaseUpdateComplexTestCase::testUpdateExpression in modules/
simpletest/ tests/ database_test.test - Test update with expression values.
- DatabaseUpdateComplexTestCase::testUpdateOnlyExpression in modules/
simpletest/ tests/ database_test.test - Test update with only expression values.
- 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.
- DatabaseUpdateTestCase::testMultiGTUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can update a multiple records with a non-equality condition.
- DatabaseUpdateTestCase::testMultiUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can update a multiple records successfully.
- DatabaseUpdateTestCase::testSimpleNullUpdate in modules/
simpletest/ tests/ database_test.test - Confirm updating to NULL.
- DatabaseUpdateTestCase::testSimpleUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can update a single record successfully.
- DatabaseUpdateTestCase::testWhereAndConditionUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can stack condition and where calls.
- DatabaseUpdateTestCase::testWhereUpdate in modules/
simpletest/ tests/ database_test.test - Confirm that we can update a multiple records with a where call.
- DBLogTestCase::doUser in modules/
dblog/ dblog.test - Generate and verify user events.
- DBLogTestCase::testDBLogAddAndClear in modules/
dblog/ dblog.test - Login an admin user, create dblog event, and test clearing dblog functionality through the admin interface.
- DBLogTestCase::verifyCron in modules/
dblog/ dblog.test - Verify cron applies the dblog row limit.
- DBLogTestCase::verifyRowLimit in modules/
dblog/ dblog.test - Verify setting of the dblog row limit.
- dblog_event in modules/
dblog/ dblog.admin.inc - Menu callback; displays details about a log message.
- DrupalDataApiTest::testDrupalWriteRecord in modules/
simpletest/ tests/ common.test - Test the drupal_write_record() API function.
- DrupalDatabaseCache::getMultiple in includes/
cache.inc - Implements DrupalCacheInterface::getMultiple().
- DrupalWebTestCase::drupalCreateRole in modules/
simpletest/ drupal_web_test_case.php - Internal helper function; Create a role with specified permissions.
- DrupalWebTestCase::setUp in modules/
simpletest/ drupal_web_test_case.php - 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.…
- drupal_get_filename in includes/
bootstrap.inc - Returns and optionally sets the filename for a system resource.
- drupal_get_installed_schema_version in includes/
install.inc - Returns the currently installed schema version for a module.
- drupal_is_denied in includes/
bootstrap.inc - Checks to see if an IP address has been blocked.
- drupal_lookup_path in includes/
path.inc - Given an alias, return its Drupal system URL if one exists. Given a Drupal system URL return one of its aliases if such a one exists. Otherwise, return FALSE.
- drupal_path_alias_whitelist_rebuild in includes/
path.inc - Rebuild the path alias white list.
- drupal_valid_path in includes/
path.inc - Checks a path exists and the current user has access to it.
- error_test_trigger_pdo_exception in modules/
simpletest/ tests/ error_test.module - Menu callback; trigger an exception to test the exception handler.
- FeedParserTestCase::testAtomSample in modules/
aggregator/ aggregator.test - Test a feed that uses the Atom format.
- FieldCrudTestCase::testCreateField in modules/
field/ tests/ field.test - Test the creation of a field.
- FieldInfoTestCase::testFieldPrepare in modules/
field/ tests/ field.test - Test that cached field definitions are ready for current runtime context.
- FieldInfoTestCase::testInstancePrepare in modules/
field/ tests/ field.test - Test that cached instance definitions are ready for current runtime context.
- FieldInstanceCrudTestCase::testCreateFieldInstance in modules/
field/ tests/ field.test - Test the creation of a field instance.
- field_sql_storage_update_7001 in modules/
field/ modules/ field_sql_storage/ field_sql_storage.install - Remove the field_config_entity_type table and store 'entity_type' strings.
- field_update_7001 in modules/
field/ field.install - Fix fields definitions created during the d6 to d7 upgrade path.
- FileFieldTestCase::getLastFileId in modules/
file/ tests/ file.test - Retrieves the fid of the last inserted file.
- FileSaveTest::testFileSave in modules/
simpletest/ tests/ file.test - FileSaveUploadTest::setUp in modules/
simpletest/ tests/ file.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.…
- FileSaveUploadTest::testNormal in modules/
simpletest/ tests/ file.test - Test the file_save_upload() function.
- FilledMinimalUpdatePath::testFilledStandardUpdate in modules/
simpletest/ tests/ upgrade/ upgrade.test - Tests a successful point release update.
- FilledStandardUpdatePath::testFilledStandardUpdate in modules/
simpletest/ tests/ upgrade/ upgrade.test - Tests a successful point release update.
- FilterAdminTestCase::testFilterAdmin in modules/
filter/ filter.test - Test filter administration functionality.
- FilterCRUDTestCase::testTextFormatCRUD in modules/
filter/ filter.test - Test CRUD operations for text formats and filters.
- FilterCRUDTestCase::verifyFilters in modules/
filter/ filter.test - Verify that filters are properly stored for a text format.
- FilterDefaultFormatTestCase::testDefaultTextFormats in modules/
filter/ filter.test - FilterHooksTestCase::testFilterHooks in modules/
filter/ filter.test - Test that hooks run correctly on creating, editing, and deleting a text format.
- filter_admin_format_form_validate in modules/
filter/ filter.admin.inc - Validate text format form submissions.
- filter_list_format in modules/
filter/ filter.module - Retrieve a list of filters for a given text format.
- filter_update_7001 in modules/
filter/ filter.install - Break out "escape HTML filter" option to its own filter.
- filter_update_7005 in modules/
filter/ filter.install - Integrate text formats with the user permissions system.
- filter_update_7008 in modules/
filter/ filter.install - Grant usage of all text formats to user roles having the 'administer filters' permission.
- flood_is_allowed in includes/
common.inc - Checks whether a user is allowed to proceed with the specified event.
- ForumTestCase::createForum in modules/
forum/ forum.test - Create a forum container or a forum.
- ForumTestCase::testAddOrphanTopic in modules/
forum/ forum.test - Forum nodes should not be created without choosing forum from select list.
- ForumTestCase::verifyForums in modules/
forum/ forum.test - Verify the logged in user has access to a forum nodes.
- forum_node_update in modules/
forum/ forum.module - Implements hook_node_update().
- HelpTestCase::getModuleList in modules/
help/ help.test - Gets the list of enabled modules that implement hook_help().
- HookBootExitTestCase::testHookBootExit in modules/
simpletest/ tests/ bootstrap.test - Test calling of hook_boot() and hook_exit().
- hook_block_list_alter in modules/
block/ block.api.php - Act on blocks prior to rendering.
- hook_comment_load in modules/
comment/ comment.api.php - Comments are being loaded from the database.
- hook_cron in modules/
system/ system.api.php - Perform periodic actions.
- hook_file_load in modules/
system/ system.api.php - Load additional information into file objects.
- hook_load in modules/
node/ node.api.php - Act on nodes being loaded from the database.
- hook_menu_link_update in modules/
system/ system.api.php - Inform modules that a menu link has been updated.
- hook_node_load in modules/
node/ node.api.php - Act on nodes being loaded from the database.
- hook_node_search_result in modules/
node/ node.api.php - Act on a node being displayed as a search result.
- hook_node_update_index in modules/
node/ node.api.php - Act on a node being indexed for searching.
- hook_search_status in modules/
search/ search.api.php - Report the status of indexing.
- hook_taxonomy_term_load in modules/
taxonomy/ taxonomy.api.php - Act on taxonomy terms when loaded.
- hook_update_N in modules/
system/ system.api.php - Perform a single update.
- hook_user_load in modules/
user/ user.api.php - Act on user objects when loaded from the database.
- ImportOPMLTestCase::submitImportForm in modules/
aggregator/ aggregator.test - Submit form with invalid, empty and valid OPML files.
- ImportOPMLTestCase::validateImportFormFields in modules/
aggregator/ aggregator.test - Submit form filled with invalid fields.
- install_verify_completed_task in includes/
install.core.inc - Verify and return the last installation task that was completed.
- IPAddressBlockingTestCase::testIPAddressValidation in modules/
system/ system.test - Test a variety of user input to confirm correct validation and saving of data.
- language_list in includes/
bootstrap.inc - Returns a list of installed languages, indexed by the specified key.
- list_update_7001 in modules/
field/ modules/ list/ list.install - Rename the list field types and change 'allowed_values' format.
- locale in modules/
locale/ locale.module - Provides interface translation services.
- LocaleImportFunctionalTest::testStandalonePoFile in modules/
locale/ locale.test - Test import of standalone .po files.
- LocaleUninstallFunctionalTest::testUninstallProcess in modules/
locale/ locale.test - Check if the values of the Locale variables are correct after uninstall.
- locale_batch_by_component in includes/
locale.inc - Prepare a batch to run when installing modules or enabling themes.
- locale_languages_edit_form in modules/
locale/ locale.admin.inc - Editing screen for a particular language.
- locale_languages_edit_form_validate in modules/
locale/ locale.admin.inc - Validate the language editing form. Reused for custom language addition too.
- locale_languages_predefined_form_validate in modules/
locale/ locale.admin.inc - Validate the language addition form.
- locale_translate_delete_page in modules/
locale/ locale.admin.inc - String deletion confirmation page.
- locale_translate_edit_form in modules/
locale/ locale.admin.inc - User interface for string editing.
- locale_translate_edit_form_submit in modules/
locale/ locale.admin.inc - Process string editing form submissions.
- locale_translate_overview_screen in modules/
locale/ locale.admin.inc - Overview screen for translations.
- locale_uninstall in modules/
locale/ locale.install - Implements hook_uninstall().
- lock_may_be_available in includes/
lock.inc - Check if lock acquired by a different process may be available.
- MenuBreadcrumbTestCase::testBreadCrumbs in modules/
simpletest/ tests/ menu.test - Tests breadcrumbs on node and administrative paths.
- MenuRebuildTestCase::testMenuRebuildByVariable in modules/
simpletest/ tests/ menu.test - Test if the 'menu_rebuild_needed' variable triggers a menu_rebuild() call.
- MenuRouterTestCase::menuLoadRouter in modules/
simpletest/ tests/ menu.test - Load the router for a given path.
- MenuRouterTestCase::testMenuHierarchy in modules/
simpletest/ tests/ menu.test - Tests for menu hierarchy.
- MenuRouterTestCase::testMenuName in modules/
simpletest/ tests/ menu.test - Tests for menu_name parameter for hook_menu().
- MenuTestCase::addMenuLink in modules/
menu/ menu.test - Add a menu link using the menu module UI.
- MenuTestCase::assertMenuLink in modules/
menu/ menu.test - Fetch the menu item from the database and compare it to the specified array.
- MenuTestCase::deleteCustomMenu in modules/
menu/ menu.test - Delete custom menu.
- MenuTestCase::getStandardMenuLink in modules/
menu/ menu.test - Get standard menu link.
- menu_delete_menu_confirm in modules/
menu/ menu.admin.inc - Build a confirm form for deletion of a custom menu.
- menu_delete_menu_confirm_submit in modules/
menu/ menu.admin.inc - Delete a custom menu and all links in it.
- menu_edit_menu_submit in modules/
menu/ menu.admin.inc - Submit function for adding or editing a custom menu.
- menu_enable in modules/
menu/ menu.module - Implements hook_enable().
- menu_link_delete in includes/
menu.inc - Delete one or several menu links.
- menu_link_maintain in includes/
menu.inc - Insert, update or delete an uncustomized menu link related to a module.
- menu_link_save in includes/
menu.inc - Saves a menu link.
- menu_load_all in modules/
menu/ menu.module - Load all custom menu data.
- menu_node_delete in modules/
menu/ menu.module - Implements hook_node_delete().
- menu_overview_form in modules/
menu/ menu.admin.inc - Form for editing an entire menu tree at once.
- menu_overview_page in modules/
menu/ menu.admin.inc - Menu callback which shows an overview page of all the custom menus and their descriptions.
- menu_update_7000 in modules/
menu/ menu.install - Migrate the "Default menu for content" setting to individual node types.
- ModuleInstallTestCase::testDrupalWriteRecord in modules/
simpletest/ tests/ module.test - Test that calls to drupal_write_record() work during module installation.
- ModuleUninstallTestCase::testUserPermsUninstalled in modules/
simpletest/ tests/ module.test - Tests the hook_modules_uninstalled() of the user module.
- module_enable in includes/
module.inc - Enables or installs a given list of modules.
- NewDefaultThemeBlocks::testNewDefaultThemeBlocks in modules/
block/ block.test - Check the enabled Bartik blocks are correctly copied over.
- NodeAccessBaseTableTestCase::testNodeAccessBasic in modules/
node/ node.test - Test the "private" node access.
- NodeAccessRecordsUnitTest::testNodeAccessRecords in modules/
node/ node.test - Create a node and test the creation of node access rules.
- NodeBlockFunctionalTest::testRecentNodeBlock in modules/
node/ node.test - Test the recent comments block.
- NodeCreationTestCase::testFailedPageCreation in modules/
node/ node.test - Create a page node and verify that a transaction rolls back the failed creation
- NodeRevisionsTestCase::testRevisions in modules/
node/ node.test - Check node revision related operations.
- NodeSaveTestCase::testImport in modules/
node/ node.test - Import test, to check if custom node ids are saved properly. Workflow:
- NodeTypePersistenceTestCase::testNodeTypeCustomizationPersistence in modules/
node/ node.test - Test node type customizations persist through disable and uninstall.
- NodeTypeTestCase::testNodeTypeCreation in modules/
node/ node.test - Test creating a content type programmatically and via a form.
- 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_test_node_load in modules/
node/ tests/ node_access_test.module - Implements hook_node_load().
- node_admin_nodes in modules/
node/ node.admin.inc - Form builder: Builds the node administration overview.
- node_assign_owner_action in modules/
node/ node.module - Assigns ownership of a node to a user.
- node_assign_owner_action_form in modules/
node/ node.module - Generates the settings form for node_assign_owner_action().
- node_assign_owner_action_submit in modules/
node/ node.module - Saves settings form for node_assign_owner_action().
- node_block_list_alter in modules/
node/ node.module - Implements hook_block_list_alter().
- node_form_block_admin_configure_alter in modules/
node/ node.module - Implements hook_form_FORMID_alter().
- node_get_recent in modules/
node/ node.module - Finds the most recently changed nodes that are available to the current user.
- node_last_changed in modules/
node/ node.module - Finds the last time a node was changed.
- node_last_viewed in modules/
node/ node.module - Retrieves the timestamp at which the current user last viewed the specified node.
- node_multiple_delete_confirm in modules/
node/ node.admin.inc - node_requirements in modules/
node/ node.module - Implements hook_requirements().
- node_revision_delete_confirm_submit in modules/
node/ node.pages.inc - node_revision_list in modules/
node/ node.module - Return a list of all the existing revision numbers.
- node_search_status in modules/
node/ node.module - Implements hook_search_status().
- node_type_delete_confirm in modules/
node/ content_types.inc - Menu callback; delete a single content type.
- node_update_7006 in modules/
node/ node.install - Convert body and teaser from node properties to fields, and migrate status/comment/promote and sticky columns to the {node_revision} table.
- node_user_delete in modules/
node/ node.module - Implements hook_user_delete().
- openid_association in modules/
openid/ openid.module - Attempt to create a shared secret with the OpenID Provider.
- openid_user_add_validate in modules/
openid/ openid.pages.inc - openid_user_delete_form in modules/
openid/ openid.pages.inc - Menu callback; Delete the specified OpenID identity from the system.
- openid_user_identities in modules/
openid/ openid.pages.inc - Menu callback; Manage OpenID identities for the specified user.
- openid_verify_assertion in modules/
openid/ openid.module - Attempt to verify the response received from the OpenID Provider.
- 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.
- PathTaxonomyTermTestCase::testTermAlias in modules/
path/ path.test - Test alias functionality through the admin interfaces.
- PathTestCase::getPID in modules/
path/ path.test - path_admin_form_validate in modules/
path/ path.admin.inc - Verify that a URL alias is valid
- PollExpirationTestCase::testAutoExpire in modules/
poll/ poll.test - poll_cron in modules/
poll/ poll.module - Implements hook_cron().
- poll_load in modules/
poll/ poll.module - Implements hook_load().
- ProfileTestCase::createProfileField in modules/
profile/ profile.test - Create a profile field.
- profile_admin_overview in modules/
profile/ profile.admin.inc - Form builder to display a listing of all editable profile fields.
- profile_block_configure in modules/
profile/ profile.module - Implements hook_block_configure().
- profile_block_view in modules/
profile/ profile.module - Implements hook_block_view().
- profile_browse in modules/
profile/ profile.pages.inc - Menu callback; display a list of user information.
- profile_field_delete in modules/
profile/ profile.admin.inc - Menu callback; deletes a field from all user profiles.
- profile_field_form in modules/
profile/ profile.admin.inc - Menu callback: Generate a form to add/edit a user profile field.
- profile_user_categories in modules/
profile/ profile.module - Implements hook_user_categories().
- profile_user_load in modules/
profile/ profile.module - Implements hook_user_load().
- profile_user_view in modules/
profile/ profile.module - Implements hook_user_view().
- RdfCrudTestCase::testCRUD in modules/
rdf/ rdf.test - Test inserting, loading, updating, and deleting RDF mappings.
- RdfTrackerAttributesTestCase::_testBasicTrackerRdfaMarkup in modules/
rdf/ rdf.test - Helper function for testAttributesInTracker().
- RegistryParseFilesTestCase::testRegistryParseFiles in modules/
simpletest/ tests/ registry.test - testRegistryParseFiles
- RegistryParseFileTestCase::testRegistryParseFile in modules/
simpletest/ tests/ registry.test - testRegistryParseFile
- registry_get_parsed_files in includes/
registry.inc - Return the list of files in registry_file
- RemoveFeedTestCase::testRemoveFeed in modules/
aggregator/ aggregator.test - Remove a feed and ensure that all it services are removed.
- SchemaTestCase::testSchema in modules/
simpletest/ tests/ schema.test - search_index in modules/
search/ search.module - Update the full-text search index for a particular item.
- search_node_update_index in modules/
search/ search.module - Implements hook_node_update_index().
- search_update_totals in modules/
search/ search.module - Updates the {search_total} database table.
- SessionHttpsTestCase::assertSessionIds in modules/
simpletest/ tests/ session.test - Test that there exists a session with two specific session IDs.
- SessionTestCase::testEmptySessionID in modules/
simpletest/ tests/ session.test - Test that empty session IDs are not allowed.
- SessionTestCase::testSessionWrite in modules/
simpletest/ tests/ session.test - Test that sessions are only saved when necessary.
- shortcut_set_delete_form in modules/
shortcut/ shortcut.admin.inc - Form callback: builds the confirmation form for deleting a shortcut set.
- shortcut_set_get_unique_name in modules/
shortcut/ shortcut.module - Returns a unique, machine-readable shortcut set name.
- simpletest_clean_results_table in modules/
simpletest/ simpletest.module - Clear the test result tables.
- simpletest_test_get_all in modules/
simpletest/ simpletest.module - Get a list of all of the tests provided by the system.
- StatisticsBlockVisitorsTestCase::testIPAddressBlocking in modules/
statistics/ statistics.test - Blocks an IP address via the top visitors report and then unblocks it.
- StatisticsLoggingTestCase::testLogging in modules/
statistics/ statistics.test - Verifies request logging for cached and uncached pages.
- statistics_access_log in modules/
statistics/ statistics.admin.inc - Menu callback; Displays recent page accesses.
- statistics_get in modules/
statistics/ statistics.module - Retrieves a node's "view statistics".
- statistics_update_index in modules/
statistics/ statistics.module - Implements hook_update_index().
- SystemInfoAlterTestCase::getSystemInfo in modules/
system/ system.test - Returns the info array as it is stored in {system}.
- SystemQueue::numberOfItems in modules/
system/ system.queue.inc - system_actions_configure in modules/
system/ system.admin.inc - Menu callback; Creates the form for configuration of a single action.
- system_actions_manage in modules/
system/ system.admin.inc - Menu callback; Displays an overview of available and configured actions.
- system_admin_config_page in modules/
system/ system.admin.inc - Menu callback; Provide the administration overview page.
- system_admin_menu_block in modules/
system/ system.module - Provide a single block on the administration overview page.
- system_cron in modules/
system/ system.module - Implements hook_cron().
- system_date_format_locale in modules/
system/ system.module - Gets the appropriate date format string for a date type and locale.
- system_get_date_format in modules/
system/ system.module - Gets the format details for a particular format ID.
- system_get_files_database in modules/
system/ system.module - Retrieves the current status of an array of files in the system table.
- system_ip_blocking in modules/
system/ system.admin.inc - Menu callback. Display blocked IP addresses.
- system_ip_blocking_form_validate in modules/
system/ system.admin.inc - system_list in includes/
module.inc - Build a list of bootstrap modules and enabled modules and themes.
- system_update_7000 in modules/
system/ system.install - Rename blog and forum permissions to be consistent with other content types.
- 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_7013 in modules/
system/ system.install - Convert default time zone offset to default time zone name.
- system_update_7016 in modules/
system/ system.install - Remove custom datatype *_unsigned in PostgreSQL.
- 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_7060 in modules/
system/ system.install - Create fields in preparation for migrating upload.module to file.module.
- system_update_7061 in modules/
system/ system.install - Migrate upload.module data to the newly created file field.
- system_update_7063 in modules/
system/ system.install - Delete {menu_links} records for 'type' => MENU_CALLBACK which would not appear in a fresh install.
- system_update_files_database in modules/
system/ system.module - Updates the records in the system table based on the files array.
- TaxonomyHooksTestCase::testTaxonomyTermHooks in modules/
taxonomy/ taxonomy.test - Test that hooks are run correctly on creating, editing and deleting a term.
- TaxonomyTermIndexTestCase::testTaxonomyIndex in modules/
taxonomy/ taxonomy.test - Tests that the taxonomy index is maintained properly.
- TaxonomyVocabularyUnitTest::testTaxonomyVocabularyDeleteWithTerms in modules/
taxonomy/ taxonomy.test - Test deleting a taxonomy that contains terms.
- taxonomy_uninstall in modules/
taxonomy/ taxonomy.install - Implements hook_uninstall().
- taxonomy_update_7002 in modules/
taxonomy/ taxonomy.install - Add {vocabulary}.machine_name column.
- taxonomy_update_7004 in modules/
taxonomy/ taxonomy.install - Move taxonomy vocabulary associations for nodes to fields and field instances.
- taxonomy_update_7005 in modules/
taxonomy/ taxonomy.install - Migrate {taxonomy_term_node} table to field storage.
- taxonomy_vocabulary_delete in modules/
taxonomy/ taxonomy.module - Delete a vocabulary.
- taxonomy_vocabulary_get_names in modules/
taxonomy/ taxonomy.module - Get names for all taxonomy vocabularies.
- toolbar_get_menu_tree in modules/
toolbar/ toolbar.module - Gets only the top level items below the 'admin' path.
- tracker_enable in modules/
tracker/ tracker.install - Implements hook_enable().
- tracker_page in modules/
tracker/ tracker.pages.inc - Menu callback; prints a listing of active nodes on the site.
- tracker_update_7000 in modules/
tracker/ tracker.install - Create new tracker_node and tracker_user tables.
- translation_remove_from_set in modules/
translation/ translation.module - Remove a node from its translation set (if any) and update the set accordingly.
- TriggerContentTestCase::testActionsContent in modules/
trigger/ trigger.test - Tests several content-oriented trigger issues.
- TriggerWebTestCase::configureAdvancedAction in modules/
trigger/ trigger.test - Configure an advanced action.
- trigger_assign_form_submit in modules/
trigger/ trigger.admin.inc - Submit function for trigger_assign_form().
- trigger_assign_form_validate in modules/
trigger/ trigger.admin.inc - Validation function for trigger_assign_form().
- trigger_get_assigned_actions in modules/
trigger/ trigger.module - Gets the action IDs of actions to be executed for a hook.
- trigger_update_7000 in modules/
trigger/ trigger.install - Adds operation names to the hook names and drops the "op" field.
- UpdateFeedItemTestCase::testUpdateFeedItem in modules/
aggregator/ aggregator.test - Test running "update items" from the 'admin/config/services/aggregator' page.
- UpdateScriptFunctionalTest::testThemeSystem in modules/
system/ system.test - Tests the effect of using the update script on the theme system.
- UpdateScriptFunctionalTest::testUpdateAccess in modules/
system/ system.test - Tests access to the update script.
- update_fix_compatibility in includes/
update.inc - Disable any items in the {system} table that are not core compatible.
- update_fix_d7_block_deltas in includes/
update.inc - A helper function that modules can use to assist with the transformation from numeric block deltas to string block deltas during the 6.x -> 7.x upgrade.
- 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.
- update_retrieve_dependencies in includes/
update.inc - Invoke hook_update_dependencies() in all installed modules.
- UpgradePathTestCase::setUp in modules/
simpletest/ tests/ upgrade/ upgrade.test - Override of DrupalWebTestCase::setUp() specialized for upgrade testing.
- 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.
- UserBlocksUnitTests::testWhosOnlineBlock in modules/
user/ user.test - Test the Who's Online block.
- UserController::attachLoad in modules/
user/ user.module - Attaches data to entities upon loading. This will attach fields, if the entity is fieldable. It calls hook_entity_load() for modules which need to add data to all entities. It also calls hook_TYPE_load() on the loaded entities. For…
- UserSaveTestCase::testUserImport in modules/
user/ user.test - Test creating a user with arbitrary uid.
- UserUpgradePathPasswordTokenTestCase::testUserUpgrade in modules/
simpletest/ tests/ upgrade/ upgrade.user.test - Test a successful upgrade.
- user_admin_account in modules/
user/ user.admin.inc - Form builder; User administration page.
- user_block_view in modules/
user/ user.module - Implements hook_block_view().
- user_external_load in modules/
user/ user.module - Fetches a user object based on an external authentication source.
- user_get_authmaps in modules/
user/ user.module - Discover which external authentication module(s) authenticated a username.
- user_login_authenticate_validate in modules/
user/ user.module - A validate handler on the login form. Check supplied username/password against local users table. If successful, $form_state['uid'] is set to the matching user ID.
- user_multiple_role_edit in modules/
user/ user.module - Callback function for admin mass adding/deleting a user role.
- user_node_load in modules/
user/ user.module - Implements hook_node_load().
- user_role_permissions in modules/
user/ user.module - Determine the permissions for one or more roles.
- user_save in modules/
user/ user.module - Save changes to a user account or add a new user.
- user_update_7000 in modules/
user/ user.install - Increase the length of the password field to accommodate better hashes.
- user_update_7002 in modules/
user/ user.install - Convert user time zones from time zone offsets to time zone names.
- user_update_7010 in modules/
user/ user.install - Update the {user}.signature_format column.
- user_update_7012 in modules/
user/ user.install - Add the user's pictures to the {file_managed} table and make them managed files.
- user_update_7013 in modules/
user/ user.install - Add user module file usage entries.
- variable_initialize in includes/
bootstrap.inc - Loads the persistent variable table.
- _book_update_outline in modules/
book/ book.module - Common helper function to handles additions and updates to the book outline.
- _comment_update_node_statistics in modules/
comment/ comment.module - Updates the comment statistics for a given node. This should be called any time a comment is added, deleted, or updated.
- _dblog_get_message_types in modules/
dblog/ dblog.module - _drupal_session_read in includes/
session.inc - Reads an entire session from the database (internal use only).
- _forum_update_forum_index in modules/
forum/ forum.module - Updates the taxonomy index for a given node.
- _forum_user_last_visit in modules/
forum/ forum.module - _locale_export_get_strings in includes/
locale.inc - Generates a structured array of all strings with translations in $language, if given. This array can be used to generate an export of the string in the database.
- _locale_import_one_string_db in includes/
locale.inc - Import one string into the database.
- _locale_import_po in includes/
locale.inc - Parses Gettext Portable Object file information and inserts into 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.
- _locale_rebuild_js in includes/
locale.inc - (Re-)Creates the JavaScript translation file for a language.
- _menu_delete_item in includes/
menu.inc - Helper function for menu_link_delete; deletes a single menu link.
- _menu_link_find_parent in includes/
menu.inc - Find a possible parent for a given menu link.
- _menu_router_build in includes/
menu.inc - Helper function to build the router table based on the data from hook_menu.
- _menu_set_expanded_menus in includes/
menu.inc - Helper function to update a list of menus with expanded items
- _node_access_rebuild_batch_operation in modules/
node/ node.module - Batch operation for node_access_rebuild_batch.
- _node_revision_access in modules/
node/ node.module - _registry_update in includes/
registry.inc - Does the work for registry_update().
- _system_date_formats_build in modules/
system/ system.module - Builds and returns information about available date formats.
- _system_date_format_types_build in modules/
system/ system.module - Builds and returns information about available date types.
- _tracker_add in modules/
tracker/ tracker.module - Update indexing tables when a node is added, updated or commented on.
- _tracker_calculate_changed in modules/
tracker/ tracker.module - Determine the max timestamp between $node->changed and the last comment.
- _tracker_remove in modules/
tracker/ tracker.module - Clean up indexed data when nodes or comments are removed.
- _update_7000_node_get_types in modules/
node/ node.install - Utility function: fetch the node types directly from the database.
- _update_7002_taxonomy_get_vocabularies in modules/
taxonomy/ taxonomy.install - Utility function: get the list of vocabularies directly from the database.
- _update_cache_get in modules/
update/ update.module - Retrieve data from the private update status cache table.
File
- includes/
database/ database.inc, line 2313 - Core systems for the database layer.
Code
<?php
function db_query($query, array $args = array(), array $options = array()) {
if (empty($options['target'])) {
$options['target'] = 'default';
}
return Database::getConnection($options['target'])->query($query, $args, $options);
}
?> Login or register to post comments
Comments
Example #1
An simple example borrowed from http://api.drupal.org/api/group/database/7 check it out for a good overview of the Database abstraction layer. Even better, checkout the Database API documentation at http://drupal.org/node/310072 for more in depth coverage
<?php
// Drupal 7
// Notice the place holders are now done using the same syntax as PDOs (:uid)
// Placeholders also don't need to be quoted anymore.
$uid = 1;
$result = db_query('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid));
// Result is returned as a iterable object that returns a stdClass object on each iteration
foreach ($result as $record) {
// Perform operations on $record->title, etc. here.
// in this example the available data would be mapped to object properties:
// $record->nid, $record->title, $record->created
}
// Same example in Drupal 6
$uid = 1;
$result = db_query("SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = %d", $uid);
while ($record = db_fetch_object($result)) {
// Perform operations on $record->title, etc. here.
}
// NOTE: db_fetch_object and db_fetch_array have been removed from D7!
?>
It's also good to know that the drupal Database Abstraction layer is built on top of the PHP Database Object (PDO) extension and uses much of the syntax defined there for accessing the database. For a good base understanding of where this new abstraction later is coming from, I recommend checking out the PDO documentation on php.net specifically check out the PDOStatement class. A PDOStatement object is not that far off from what is returned from:
db_query()And drupal has used some of those functions (e.g. PDOStatment::fetchObject()), as well as added some new ones, to the Database API. Here are some quick examples (borrowed from the Database API documentation)<?php
// Using the same query from above...
$uid = 1;
$result = db_query('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid));
// Fetch next row as a stdClass object.
$record = $result->fetchObject();
// Fetch next row as an associative array.
$record = $result->fetchAssoc();
// Fetch data from specific column from next row
// Defaults to first column if not specified as argument
$data = $result->fetchColumn(1); // Grabs the title from the next row
// Retrieve all records into an indexed array of stdClass objects.
$result->fetchAll();
// Retrieve all records as stdObjects into an associative array
// keyed by the field in the result specified.
// (in this example, the title of the node)
$result->fetchAllAssoc('title');
// Retrieve a 2-column result set as an associative array of field 1 => field 2.
$result->fetchAllKeyed();
// Also good to note that you can specify which two fields to use
// by specifying the column numbers for each field
$result->fetchAllKeyed(0,2); // would be nid => created
$result->fetchAllKeyed(1,0); // would be title => nid
// Retrieve a 1-column result set as one single array.
$result->fetchCol();
// Column number can be specified otherwise defaults to first column
$result->fetchCol($db_column_number);
// Count the number of rows
$result->rowCount();
?>
Please note that the above
Please note that the above Drupal 7 example is incomplete. It is missing a fetch command.
Getting a Single Value
Example from «Pro Drupal 7 development book (3rd edition)»:
If all you need from the database is a single value, you can use the ->fetchField() method to retrieve that value. Here is an example of retrieving the total number of records from the joke table:
$nbr_records = db_query("SELECT count(nid) FROM {joke}")->fetchField();You must use single quotes
This is new in Drupal 7. Although MySQL doesn't care about single or double quotes, other SQL engines do.
Works:
SELECT delta FROM {block} WHERE status = 0 AND module = 'tracker'Does not work:
SELECT delta FROM {block} WHERE status = 0 AND module = "tracker"This killed me so hard. I
This killed me so hard. I spent an hour bashing my head against queries that worked perfectly when run directly against the db but failed in db_query. I've done tons of work in d6, but this is my first d7 site.
If you're getting
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'xxxxx' ...where xxxxx is a value and was never supposed to be a friggin' column name to begin with, check to make sure you're wrapping string values in single quotes.
My more complicated example:
FAILS:
$sql = 'SELECT n.nidFROM field_data_field_run_date rd
INNER JOIN node n ON rd.entity_id = n.nid
WHERE STR_TO_DATE(rd.field_run_date_value, "%Y-%m-%dT%T") <= NOW()
AND n.type = "potd"
AND n.status = 1
ORDER BY rd.field_run_date_value DESC, n.created DESC
LIMIT 1
';
WORKS:
$sql = 'SELECT n.nidFROM field_data_field_run_date rd
INNER JOIN node n ON rd.entity_id = n.nid
WHERE STR_TO_DATE(rd.field_run_date_value, \'%Y-%m-%dT%T\') <= NOW()
AND n.type = \'potd\'
AND n.status = 1
ORDER BY rd.field_run_date_value DESC, n.created DESC
LIMIT 1
';
The reason your first query
The reason your first query fails, is that you're trying to use double quotes (or "").
If you know quotes are going to be used in a query, open and close your statement with double quotes and wrap any VALUES in the statement that require quotes with a single quote.
It appears that if you use
It appears that if you use query strings that span multiple lines, the named arguments don't appear to work. Removing newlines from the query string solves it. Anyone else experiencing this issue?
Multilines work fine
I'm using query string of as many as 20 lines without a problem.
On another note, the named variables should NOT be put between single quotes:
Wrong:
...WHERE node.type = ':named-argument' ...Right:
...WHERE node.type = :named-argument ...Just a note that doesn't
Just a note that doesn't appear to be documented:
If your table contains column names with uppercase letters, they will be converted to lowercase in the resulting stdClass object you get when iterating through the result object db_query() returns to you.
Placeholders do not work with LIMIT
This fails:
<?phpdb_query("SELECT nid FROM node LIMIT :d",array(":d"=>3));
?>
Use this instead:
<?phpdb_query_range("SELECT nid FROM node",0,3);
?>
Placeholders expect array when using IN()
I had a query like this
<?php$result = db_query("SELECT entity_id, some_col from {my_table} WHERE some_col IN (:my_ids)", array(':my_ids'=>$my_ids));
?>
When $my_ids where a comma separated string of numbers, I got only 4 results instead of the expected 13 rows. I passed in an array of values, all my expected results came up.
implode
use implode(',', $my_ids) or if you're using 6: db_placeholders
drupal 7 db_select tablename keyword
$results = db_select('order', 'o')
->extend('TableSort')
->orderByHeader($header)
->fields ('o', array (
'team_id',
'sku',
'pay_time',
'state',
'money',
'order_num',
))
->condition('team_id', (int) $team_id)
->execute()->fetchAll();
have something wrong , but this:
$results = db_select('order1', 'o')
->extend('TableSort')
->orderByHeader($header)
->fields ('o', array (
'team_id',
'sku',
'pay_time',
'state',
'money',
'order_num',
))
->condition('team_id', (int) $team_id)
->execute()->fetchAll();
and I changed my tablename from order to order1
that is OK.
I know that is db keyword , but how I can use orderByHeader in D7 and don't edit my db tablename.
I am from China , my English is poor.