Tagged Questions

Topics related to the database API implemented by Drupal.

learn more… | top users | synonyms (1)

3
votes
3answers
43 views

How to perform join with multiple columns using db_select?

How to perform join with multiple columns using db_select? Any help? Here below is the sample, which I'm looking for. SELECT * FROM digitaliq_flds_by_node a JOIN digitaliq_fld_category b ON ...
2
votes
2answers
30 views

what is the best way to insert arrays of values in drupal 7

i am tring to insert multible values from textarea to the db table called banned_users foreach ($user_emails as $key => $value) { $insert_banned_emails = db_insert('banned_users'); ...
0
votes
0answers
22 views

“Select” form field depending from another “select” form field receives just a value

I am working with a custom form using two "select" form fields where one depends from the other one. The second "select" form fields receives only one value. What is wrong with the code I am using? ...
2
votes
1answer
23 views

convert to db_query and addExpression

Is there a way convert this static query in a dynamic query? $sql = "SELECT n.nid, n.title, n.created, n.type, n.status, IF((SELECT nid FROM `newsletter_lists` WHERE cid=$cid AND nid=n.nid), TRUE, ...
2
votes
1answer
30 views

How can I use the MySQL FIELD() function within a SelectQuery object in Views?

I want to use the MySQL FIELD() function to alter a query so that it orders a particular field on a particular order of keys. The keys for this 'select' field are: active, under_contract, sold I ...
3
votes
1answer
37 views

Mapping regular SQL to Drupal's Database API - using 'exists'?

I have the following SQL that I'm trying to translate using Drupal's Database API: select nid,biblio_type from biblio where not exists (select * from biblio_types where biblio_type = tid); What ...
0
votes
1answer
15 views

How to use addField function when the field name is SQL keyword

I have a field with name 'order' in the database. How to select it, using addField? $query->addField('sco_groups', 'order'); Gives an error.
5
votes
2answers
52 views

Use a database specific function in dbtng (e.g. uuid in db_insert)

I have a table that contains a char(36) field for a uuid. It seems like I can insert data into that field with a mysql query like: INSERT INTO mytable (uid, event_guid) VALUES (1, uuid());. I'd like ...
0
votes
1answer
12 views

How to process the data which type is BLOB?

I get the following data from MySQL by db_query(). The type of the column is BLOB. a:2:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}s:8:"langcode";s:7:"zh-hans";} How should I process it?
-3
votes
0answers
55 views

How would I create relationship in Drupal? [closed]

I use Yii Framework and I am starting on Drupal. I have a system with tables: cooperator role group profile cooperator are relationship with role, group e profile. I would like to know how to do ...
0
votes
2answers
50 views

Print the query which is built using db_select()

I want to print the query which is built using db_select() in a programmatical way. Is there any API function provided by Drupal Abstraction Layer? It is similar to query output in Views, but I want ...
2
votes
1answer
26 views

When should I be using database transactions?

I know this is a question that depends on the details of a specific situation, and a rather open-ended question at that. But, nevertheless, are there any good guidelines out there about when database ...
0
votes
1answer
19 views

Migrate failure: on clause is ambiguous

I'm working with the migrate module for the first time and I've worked with the db_select api a little bit, but I'm running into an error. I'm trying to convert some old labels into a drupal ...
2
votes
2answers
42 views

Can I control which database Drupal uses for certain data?

It is of course possible in a custom modules to use two different databases (and I mean different databases not different RDBMSs!), but is there a way to use two different databases, and then force ...
2
votes
2answers
51 views

Extract the database abstraction layer

If it's possible, how can I go about extracting the database abstraction layer to use in a non-Drupal site?

1 2 3 4 5 11
15 30 50 per page