Questions tagged [database]

Drupal provides a standard, vendor-agnostic abstraction layer for accessing database servers.

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

Displaying external SQL-table as paginated list

The following code works well for displaying a paginated list of Drupal users. function generate_list() { $query = db_select('users', 'u') ->extend('PagerDefault') ->fields('u', array('...
Alexander Farber's user avatar
8 votes
2 answers
4k views

db_affected_rows in Drupal 7 for db_query

I just noticed that @Berdir was so nice to remove db_affected_rows from Drupal 7. I'm now wondering what the best practice is now to detect if the query you ran changed anything in the database. A ...
googletorp's user avatar
  • 35.4k
3 votes
2 answers
3k views

Displaying SQL-table as a paginated list

I'm trying the following and it works: my.module: function my_menu() { $items['page_example'] = array( 'title' => 'Page Example', 'description' => 'Page Example', ...
Alexander Farber's user avatar
-1 votes
1 answer
1k views

When should the "translatable" tag be added to a query?

I noticed that a Drupal core function is using the following code. $categories = db_select('contact', 'c') ->addTag('translatable') ->fields('c', array('cid', 'category', 'recipients', '...
apaderno's user avatar
  • 97.4k
71 votes
3 answers
12k views

Given that db_select is much slower than db_query, why would I want to use it?

For the background on this, please see http://drupal.org/node/1067802. Given all that, what situations exists where I might want to use db_select(), or should I be relying solely on db_query?
Chris Cohen's user avatar
  • 1,945
14 votes
3 answers
8k views

NoSQL vs Other SQL Drupal Setups

What are the advantages of running NoSQL (ex MongoDB) over MySQL, PostGRE SQL or MSSQL in Drupal? Are the advantages gained from simply using the storage or does some Drupal configuration need to ...
Kevin's user avatar
  • 27.8k
18 votes
5 answers
27k views

Is it possible to restore a deleted node?

While revisions are kept and it is easy to get back to a previous revision of a node, I was wondering if it is possible to restore a node that has really been deleted by a user?
Palmin's user avatar
  • 383
20 votes
4 answers
14k views

How do you make sortable tables with a pager with data from a custom table?

For Drupal 6 you could do something like this: $header = array( array('data' => t('Order id'), 'field' => 'order_id'), ... array('data' => t('Transaction time'), 'field' => '...
googletorp's user avatar
  • 35.4k
1 vote
1 answer
413 views

Custom SQL: nodereference joins and latest VID

I'm having a heck of a time constructing a custom SQL query. The query has multiple nodereferences and needs to return the latest node revision. I understand joins pretty well, but for some reason ...
ack's user avatar
  • 2,149
5 votes
4 answers
2k views

Good practices working with databases

I'm learning Drupal, and I want to develop a website where the main thing is its database. I already have the Extended Entity-Relationship Model of the database (kind of complex). What's the right ...
Oscar Mederos's user avatar
39 votes
3 answers
7k views

How do I merge changes from a development copy of the site to the live site without losing new content?

What is the best procedure for merging work done on a development copy of a site to the live production copy? Often times there has been a lot of new content added to the site since development ...
Chaulky's user avatar
  • 6,453
5 votes
5 answers
5k views

Running Drupal in a Windows environment (IIS, SQL Server)?

We are in the process of evaluating Drupal to replace our in-house .NET CMS. We run an IIS 7.5 web farm with a SQL Server 2008R2 on the back end. To make matters worse, we use sql server merge-...
James Stallings's user avatar
24 votes
4 answers
13k views

Custom query in Views?

At some point I found the need to modify an SQL query generated by Views, in the end I overrode views_pre_execute and changed the query for that specific view. This feels like an ugly hack to me and ...
Mad Scientist's user avatar
37 votes
4 answers
28k views

What's the proper way to use EntityFieldQuery?

In Drupal 7, the API documentation for node_load_multiple() says that using the $conditions parameter has been deprecated in favor of using EntityFieldQuery. In which way should EntityFieldQuery be ...
6 votes
2 answers
2k views

Drupal 7 and MongoDB module howto

Just installed 7.x-1.0-beta1 to Drupal 7rc1. Should I see some new option in the configuration? Where should I set the connection settings? I have no idea how to use this module...
user avatar
6 votes
4 answers
5k views

How to access data from external MS SQL database tables in a Drupal site running on MySQL

I am currently working a academic medical department that uses a lot of MS SQL databases because faculty set them up - making us the maintainers :( We also recently launched Drupal 6 site on LAMP, ...
JeroenEijkhof's user avatar
13 votes
3 answers
14k views

What does vid mean

I have designed a view and I see this query in the preview section: SELECT node.nid AS nid, node_data_field_crm_history_brokerid.field_crm_history_brokerid_value AS ...
user avatar

1
59 60 61 62
63