2
votes
1answer
35 views

Can db_select cope with mysql “case when” structures?

I have a complex mysql query with "case when" to combine values across multiple rows in columns. I'm currenty using db_query, but I would like to use the TableSort and Pager extenders. But (correct me ...
0
votes
1answer
32 views

Where In or clause for when a variable might not exist

If I were to run a normal mySQL query that selects all nodes I would do this: set @type='node'; select * from actions where type = @type; but what if lets say I set type to be something that ...
5
votes
2answers
131 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
131 views

Can I create a table with hook_schema that has two timestamp fields?

For my module I want to create a table with an updated_on and created_on field, both of type timestamp. I found this can be done with mysql_type, but you need to specify a default value for that ...
1
vote
1answer
712 views

Drupal 7 timestamp insert into mysql error

i get error when i want to insert current time to my table-field date, i get this error PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '1345724717' for ...
1
vote
2answers
331 views

Database Abstraction Layer and 'LOAD DATA INFILE' Statements

I realize that using the database abstraction layer comes with a few caveats such as not being able to run queries that are not available in one way or another across all versions of the databases ...
11
votes
1answer
1k views

Drupal 7 exposing non drupal tables in views

I was wondering what is the best way to allow the Views module to access external tables not in Drupal? I tried the Data module, but it doesn't allow for a datetime datatype. Thanks in advance! ...
2
votes
2answers
357 views

Drupal 7 db_query using CAST

Does Drupal 7's DB API support SQL's CAST function? I have a varchar with numbers in it that I'm trying to convert to integers for proper sorting. Here's my statement: $images = db_query('SELECT ...
3
votes
1answer
406 views

Transactions in Drupal 6

I am running drupal 6.22 with MySQL. There is no drupal 6 API for using transactions. Since I am new to drupal, I do not know which is the best way to use transactions using the existing drupal APIs? ...
0
votes
2answers
195 views

Fatal error: Call to undefined function db_transaction()

I am new to drupal. In an attempt to achieve transaction, I get this fatal error. I am using drupal 6.22 and MySQL. db_query() and all the other database related functions are working fine, but ...
1
vote
2answers
308 views

db_query() function in a foreach cycle - only the first query is getting executed (D6)

I have a query, which I have to run in a foreach cycle. I run the query with db_query() function. My code looks similar to this one (of course, this is just an example code with example values): ...
10
votes
3answers
3k 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 ...