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

learn more… | top users | synonyms (6)

0
votes
0answers
5 views

Importing large amount of data slow process with cron and queue

I am currently importing large amount of data into Drupal and I am using the hook_cron with the queue API and so far everything is working. Data is been imported as nodes and the relationship between ...
1
vote
2answers
15 views

Have module .install create a table in a non-default DB

I have constructed a module that, using the .install file, creates a table on a database different than the default. The module installs fine and functions fine – just a hello world example in the ...
2
votes
1answer
12 views

Delete query is called while updating the value of node

Delete query is called while updating the cck field value of node. After debugging i find following code in var/www/drupal-7.40/modules/field/modules/field_sql_storage/field_sql_storage.module ...
2
votes
1answer
182 views

How to programmally add nodes with next nid?

i want to create multiple nodes (from csv file) the csv is loaded well, and my table node contains many old records (with nid from 1 to 170) what i want is to record the csv's new nodes with nid ...
1
vote
2answers
43 views

How to call limited data items per page?

I am using one custom module, which is getting data from the database, with the following code. function rs_get_doors() { $doors = array(); $doors_nids = db_select('node', 'n') $doors_nids = ...
0
votes
0answers
11 views

Pagination using db_select()

I have custom module where I am using multiple db_select() in my module page, and I am getting data from different columns to show them by combining them. I now want to paginate the data, but with the ...
0
votes
1answer
35 views

How to dynamically create Drupal 7 tables based on form API input values?

I have an array with the data below: arr_fields[0] = 'a bigint' arr_fields[1] = 'b bit' I want to structure it just like the array structure below: $fields = array( 'a' => array( ...
0
votes
2answers
23 views

Create Database Table in Run Time

I have an SQL CREATE TABLE. CREATE TABLE myid_template_1 ( template_id int NOT NULL, template_description character varying NOT NULL, ); I want to know its equivalent query structure in Drupal 7 ...
3
votes
2answers
91 views

Is it a good way to change multiple text fields values via MySQL or is there any other preferable way?

The site has a content type and this content type has two fields: Text Field Term Reference Field There are thousands of nodes on this content type and I want to change some values (find/replace). ...
0
votes
1answer
19 views

Building a custom module holding a simple form, submitting to the database [on hold]

I'd just started on Drupal and I'm pretty lost after creating my own custom module. So far I've only created a page that shouts 'Hello World'. What I want to do is just create a simple page that holds ...
2
votes
1answer
17 views

Adding a temporary column to a db_select query

I'd like to add a temporary column with a fixed value to a database query. Eg a column called 'type' with a value of 'thing' for every result. I have tried using the addExpression and addField ...
-1
votes
1answer
30 views

Save Nodes with Field collection in a different database

I am trying to node_save($node) in different database. Second DB is clone of first DB. its the part of Archive old content data in different database I am trying with following code $node = ...
0
votes
0answers
11 views

Query doesn't seem to handle the paging

I am running a paginated query on a Drupal 7 site and the page seems to be working correctly (page 1 is the url with a # at the end, page 2 appends ?page=1, page 3 appends ?page=2, etc.). However, ...
0
votes
1answer
17 views

Select only if row not exists in joined table

I have a db_select that selects row from t_project_proposal_writer table only if in joined t_project_milestone table row with milestone_id 10 is found: $query = db_select('t_project_proposal_writer', ...
1
vote
1answer
29 views

Migrating from Drupal 7: source database does not contain a recognizable Drupal version

After looking at this issue, it appears to be my schema_version. How and what do I need to change about the table to get it recognizable as a Drupal version?
0
votes
1answer
19 views

Equivalent query of “Select All”

I have this query: SELECT * pg_type; What is its equivalent query in Drupal 7? My code throws an error. $query = db_select('pg_type', 't1', array('target' => 'import')); $result = ...
0
votes
0answers
11 views

Query all available data types in a typical postgres server

I want to query all available data types in Postgres. How will I do that in Drupal 7 Form API? My code below only query all the data types used by my tables. $query = ...
0
votes
1answer
22 views

db_select with subquery including conditions from 2 tables

I spent much time without success to search how to convert with db_select the following query, running perfectly with db_query : SELECT * FROM job_orders j WHERE j.statut = 'To do' ...
3
votes
1answer
28 views

Field Collection vs. Paragraphs

I used Field Collection in my previous sites and I faced some performance issue, So this time i am looking a alternative for Field Collection. I find a answer Alternative to Field Collection. but I ...
0
votes
0answers
31 views

Extract webform result by using php [duplicate]

I have eight pages using this same webform. My webform have two fields: email and "get current URL". My Thank you page (when submitted webform) URL link state sid = "88". I DO NOT want "thank you ...
1
vote
2answers
37 views

Drupal 8 serialize selected fields using Serialization

I have a requirement in a project having 350 fields. But when I use views facing a lot performance issues. So in place of reading all the data from individual tables can I use serialization as ...
1
vote
1answer
30 views

Where can I find the link between field answers and the user who submitted it?

Noob here. I can't figure out how entity forms stores which user submitted each answer for it's fields on the database. All I can see is a table for each field, and the columns within being: ...
0
votes
1answer
12 views

Get blank value if field value is not available

I have following query on my D7 project $query = db_select('payment_logs', 'p'); $query->join('field_data_field_frequency', 'd', 'd.entity_id = p.nid'); ...
3
votes
1answer
23 views

Get all databases name present in Postgres Server in Drupal 7 Form API

I was currently developing a module and I want to display the names of all the databases present in my Postgres server through a query. I want also to query and list the names of schemas, tables, ...
0
votes
1answer
42 views

How to overcome a database error on field deletion

I have read the other SQLSTATE[42S22] questions here, and they seem to all be about modules that have not completed setup properly, but I think my issue is different. Whenever I try to delete a field ...
0
votes
0answers
19 views

How to add completely custom URLs to Sitemap in module XMLSitemap in Drupal 7

I have a website with which has some different URLs that are not inserted in the url_alias table not embedded into Drupal content system, but they are generated on-the-fly by custom PHP logic inside a ...
0
votes
1answer
35 views

Writing a migration from non a non Drupal site

How can I translate this in a migrate query? SELECT t.name FROM tags t join tag_types tt on (tt.id = 3) join story_tags stg on (stg.tag_id = t.id) WHERE story_id = $row_id' I tried ...
0
votes
1answer
11 views

cloning a live drupal website (db) to a local / working mamp version [duplicate]

I have a drupal multi-site project, that I've inherited. I am stuck on the process of trying to clone or import the database from a live server to the local enviroment. Does anyone have any ...
0
votes
1answer
32 views

Find entity id in database

I am currently moving a website from Drupal. The information I need to transfer is divided to many DB tables and connected through entity_id (That is my understanding, I have no experience in Drupal). ...
0
votes
1answer
24 views

Database connection onto an module

i'm new into the world of Drupal, i'm a student comming from the Symfony ^^ I have create a module an i want to add an database connection for my module. In looking for an answer i have see the ...
0
votes
1answer
21 views

Probably corrupted database by deleting records from node / node_revision

I did something where everybody said never ever do it: some weeks ago I deleted records from the node- and/or node_revision tables manually (DELETE FROM TABLE ...), and thought it won't harm. But now ...
0
votes
1answer
12 views

db_select throws PDOException

Trying to do a simple query from a table called 'raffles' under the drupal database. It is not a complex query, Just trying to get all sets from drupal.raffles $query = db_select('raffles'); ...
7
votes
2answers
308 views

Why is settings.php in the web folder?

In the default installation, settings.php is located at sites/default/. There are no recommendations in the official Drupal website about changing the location of this file. Doesn't it pose a ...
1
vote
1answer
13 views

Adding like condition to db_select for section of string

What I am trying to do is find all of the basic pages where their titles contain 'Meetings' for example January Meetings Here is what I have tried so far $string = 'Meetings'; $query = ...
0
votes
1answer
27 views

Execute Code After Successfully Inserting a Record in the Table

I have a form element below: //Calls a function that contains the html for templates table. $form['myid_templates_editor_table_wrapper'] = array( '#type' => 'item', '#markup' => ...
0
votes
0answers
8 views

Form Builder Module for Dupal 7 for External Tables

I am looking for a form builder module for external database tables. Or more specifically, I need to be able to create forms where users can edit information in the database, and submit new database ...
0
votes
2answers
35 views

Inserting data to external DataBase

i'm trying to insert data to a different data base that i created. I've read a lot in the forum, the support documents and other pages but i haven been able to figure it out the problem, can someone ...
0
votes
1answer
30 views

How do you turn off clean URLs in the database?

How do I turn off clean URLs in Drupal 8 from the database? What table do I look in and what variable do I have to change?
0
votes
0answers
14 views

DB Abstraction Layer: Escape Table Names with Schema

I have been using db_query() to execute some queries and previously I escaped the table names with curly braces like so: db_query('SELECT * FROM {TABLE}'); Due to circumstances which I cannot ...
0
votes
0answers
26 views

Entity reference preformance : one to many or many to one

I have two content types : Cart and Cart line item. I need to link them by using entity reference. One cart may have many line item and one line item belongs to only one cart. In term of performance ...
0
votes
1answer
15 views

Adding a new NOT NULL field to a table causes an error

When attempting to add a new column to a table within an update hook, the error Null value not allowed: 1138 Invalid use of NULL value occurred, the definition was changed to allow NULL, and the value ...
0
votes
0answers
21 views

Big cache_form slows Drupal website and the whole server [duplicate]

I have a custom form in my site. After couple of months a big issue appears. Not only that the table cache_form has become huge, but also if I empty that table and disable my custom form, the ...
1
vote
1answer
28 views

How to get Final SQL query when using Views?

How do I get complete SQL query from Views, the one I could run in mysql directly.For example biggest stumbling block is fields part. Like below SELECT users_node.uid AS users_node_uid, node.created ...
0
votes
1answer
47 views

How to store data in database with Form API?

I'm new to developing Drupal 7 modules, and I can't figure out why my custom module's form data is not stored in my database's table called 'media_skins'. I followed the info explained in Creating ...
0
votes
2answers
17 views

Dev version connects to the live site database despite settings.php

I've made a dev copy of the site to perform some tests and bug fixes: copied site files to the separate directory copied database under the same user, so I'm able to see both DBs in the phpmyadmin ...
2
votes
1answer
20 views

Find/Replace in File Field

I'm working with a site that has many files that have been uploaded to it. Data has been pulled from these files to populate fields such as title, description, etc. Some of these fields contained ...
0
votes
0answers
23 views

Can't access my admin account [duplicate]

This morning suddenly after hours of work I found my self unable to access admin account, just a blank page without any info. The anonymous and authenticated users are logged in normally without any ...
0
votes
0answers
11 views

cache table should be truncated if doing it in database?

Given this information from Clearing cache In the database Use phpMyAdmin or another tool to access the database tables and TRUNCATE (empty, not remove) all tables that start with cache_. ...
0
votes
1answer
36 views

Which module hook to use for CRUD operations on custom table?

I have used hook_schema() in my module to create a custom table in the Drupal database - the data is unrelated to anything in Drupal. I would like administrators to be able to insert, update etc. ...
1
vote
1answer
18 views

“Click to show” text at pages

How can I implement "click to show" some text data at pages? Also I need to save log in database about events. I've found tiny module Field Value Loader (Show field on click) Is there any similar ...