Questions tagged [database]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
38 views

List all the nodes with the same menu parent ID

I have the following menu in my system. The parent menu-link connects to a node whose ID is 58. All the sub menu-links have a parent ID equal to 58. I need to find the main and the sub-menus using 58,...
-3
votes
1answer
38 views

How to get table names from external DB in non public schema

I am writing a configuration entity modul in drupal 9. I want to list all tables, from an external database (postgis) in the schema called gi. The switch between the databases is no problem. I'm ...
0
votes
0answers
24 views

Query the database for the value of a ckeditor field

So I want to QUERY the database for the contents of a field, the trouble is the field is a ckeditor field, so how do I write the condition correctly? Normally it would be something like this: $query = ...
0
votes
0answers
38 views

Multiple unnecessary joins when creating an andConditionGroup()

I have a large array of names and surnames, I need to know which of these differ from the current ones in the database. For example: $largeList = largeList(); $storage = $this->...
1
vote
1answer
89 views

Can't restore existing site (no route found for "GET /")

I have a site with Drupal 9.2.5 and the site was clobbered after installing WordPress in the web root. I have a backup of the site database, and the sites/default/* files, but I just can't get Drupal ...
0
votes
1answer
30 views

Custom Migration Plugin MySQL Error

I've run into the following error when running the command drush migrate-import custom_spotlight where custom_spotlight is the name of the plugin. I've been following along with this guide: https://...
1
vote
0answers
48 views

Securing the DB: What tables should the MariaDB user have CRUD permissions for browsing the site?

I'm trying to lock down the database on my Drupal 9 install so that people can browse the website, but can't write to it. Say I have 2 users in MariaDB with access to the database: public private I ...
1
vote
0answers
37 views

entityQuery returns wrong result: too many joins?

I built an entityQuery for a custom entity type "vote". I only want to get those votes for a specific poll and those by deputies who are members of a specific fraction. The fraction ...
0
votes
0answers
27 views

Cannot access mysql in new docker/docksal/d9 installation

I had a D9 installation running in MacPorts. I installed docker and docksal, copied the D9 project to the docksal project folder, and uninstalled MacPorts. Docksal starts up like this: Starting ...
2
votes
1answer
31 views

Join with Like in Views Plugin

Attempting to do a join with a LIKE operand in a Views filter plugin. The query looks similar to below; however, when it executes, the LIKE operand is not taken into account and the join is done with ...
0
votes
1answer
57 views

Get path (alias) from SQL query

I have a SQL query to get all nodes with their ID, title, publish date, change date, etc. Additionally I need to get path to each of them (probably from path_alias.alias). Now I have following (...
0
votes
0answers
14 views

Managed file element in custom field module doesn't save target id

I have been breaking my head on this issue for a few days now. Using Drupal 9.2.x, I am building a custom field module for a client that has multiple fields. I isolated the problem by only including a ...
-1
votes
1answer
57 views

How do I programmatically set a database connection?

Hello can anybody help with a external Database Connection. $postgis_database = array( 'database' => $drugis_postgis_connection->getdatabase(), 'username' => $...
0
votes
1answer
42 views

Optimize fetching data from entity objects [duplicate]

Currently we are using EntityTypeManager to either load or loadMultiple : $this->entityTypeManager->getStorage('node')->loadMultiple($nids); $this->entityTypeManager->getStorage('node')-...
-1
votes
1answer
20 views

How do I add link to Edit and Delete in a column in a view table item list?

I've trying to add a link to Edit and Delete column to perform desirable actions. I need help in implementing it. I've tried several suggested methods on the internet, but none did the job for me. ...
0
votes
0answers
15 views

FillPDF not displaying 'foreign' characters

I'm using the fillpdf module with the online FillPDF service to render the PDFs. Most everything is working great; however, if a database field I'm displaying on the PDF contains certain 'foreign' ...
0
votes
0answers
21 views

Content Translation installation breaks the website (statistics module error + aliases not taken into account)

First, I would like to say I am a total noob in Drupal and PHP but possess some knowledge on other web frameworks/languages). Here is my path to the errors: I used the UI to install Content ...
0
votes
1answer
41 views

can you search database for page values

I have taken over a Drupal 7 site which used to be on a different server and has now moved to ours. I have discovered that on lots of Pages, there are images which point to the wrong server name, the ...
0
votes
0answers
42 views

Multiple databases

I'm having trouble getting Drupal to switch between multiple databases. I have a system that involves connecting to an external database to retrieve data. I am using the following code inside of a ...
0
votes
0answers
24 views

ddev sequelace not connecting (how to debug?)

According to this https://ddev.readthedocs.io/en/stable/users/developer-tools/#database-management we should be able to type ddev sequelace and have sequelace connect to the db server in ddev. However ...
-1
votes
1answer
117 views

Site broken with multiple errors

I am trying to install a Drupal site locally on a new laptop that was working fine on the old one. I get the following errors. Notice: Undefined offset: 2 in Drupal\Core\Database\Database::...
1
vote
0answers
44 views

When old field revisions should be deleted from the database?

I have a question about old fields revisions in Drupal 8. For example I have "Full Title" field in different paragraphs. I have deleted this field from one of the paragraphs, for example ...
0
votes
3answers
61 views

Use read-only database user to minimize security risks

I want to phase out an old, unmaintained Drupal 6 page. The website should still stay online, but should be read-only. I want to change the database user so that it only has read privileges. I don't ...
0
votes
0answers
44 views

update a entity with presave method to avoir a loop

In the hook_entity_update function update_candidat_from_contrat_direct(Drupal\Core\Entity\EntityInterface $entity) I call another function in which : I create a new node $new_entity = \Drupal::...
0
votes
0answers
16 views

How to capture the SQL on database errors

Is there a way to capture the SQL that was submitted to the database when the database throws an error?
0
votes
0answers
16 views

LOAD DATA LOCAL INFILE suddenly stop working [duplicate]

I have created a script that insert record from csv to data but it suddenly stop working on and I am getting error : General error: 2 File '/code/sites/default/files/data_file/CSVFile.csv' not found (...
0
votes
0answers
30 views

Dump raw select query with parameters values

I would like to debug select query and I use the next code, for example: $connection = \Drupal::service('database'); $query = $connection->select('node', 'node'); $query->fields('node', ['nid']) ...
9
votes
1answer
227 views

What is the significance of dumping the tablespaces?

While recently running drush sql-dump on a server where there were never any error messages, I have started to get: mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(...
1
vote
1answer
40 views

Is there a database lock mechanism?

I have a parent child entity relationship which is driven by a REST API. The payload contains data for both the parent and the child. The parent can have many children. When the (child) payload is ...
1
vote
1answer
81 views

Check if the connection to the database is available

I have 2 databases, the first one with Drupal and the second one with external data. In a controller I want to read data from that second database and display it. As the external database can be ...
1
vote
2answers
113 views

Limit size of cachetags table

One of the site has fairly large cachetags table at over 418K records. Is there a way to limit the size of this table. This table is not cleared on cache clear. Since Drupal 8.4 there has been a way ...
0
votes
1answer
48 views

Dynamic query with left join

I need to collect comments that belong to certain user and submitted on pages of certain content type nodes. Currently I'm making two queries: $nodes = db_select('node', 'n') ->fields('...
0
votes
0answers
119 views

Failed to update database after upgrading to 8.9.13

I'm new to drupal and was recently tasked with upgrading the drupal core version of one of our sites. I upgraded from 8.3 to 8.9.13 and everything went smooth enough until it came time to update the ...
1
vote
0answers
23 views

Double Publish is Required To Update Data When Node is Under High Traffic

We have a high-volume production site that is running into issues of serving stale data when a node is republished. Description/Example Of Issue I go into a node, create a new draft, then make some ...
-1
votes
2answers
70 views

How do I join two tables?

I was following this tutorial on Drupal module development. It talks about database query joins in module development. The tutorial is made for Drupal 8 and I'm using Drupal 9. Then I made this (look ...
0
votes
2answers
148 views

Converting a Views SQL query with INNER JOIN to an EntityQuery

I'm trying to create a custom JSON:API resource that returns the entities that have been flagged by a user. (The Flag module does not offer a way to get this out of the box.) I used Views to build a ...
1
vote
1answer
87 views

Unable to get titles to show up as higher priority in search than content

I have a website I am working on that has a TON of content. The client has noticed that when searching for titles in the site search, it seems to prioritize the body content over the title. So I ...
0
votes
0answers
56 views

How to migrate PDF files to specific node

I have a directory with PDF files and I have 45 nodes of content type Download. I have to migrate each PDF file to specific node. All PDF file names I read from a CSV. Before these PDF files, I had to ...
0
votes
0answers
445 views

PDO database connection error?

Super strange, my site was up and working fine yesterday. Today, I navigate to my home page and I'm thrown this series of errors: Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo ...
1
vote
1answer
58 views

EntityQuery PHP issue when assigning the query to a variable

I am very confused about this behavior of EntityQuery, or maybe I am just missing something basic about PHP. Here is the query I am working with: $entity_query_points1 = \Drupal::entityQuery($...
3
votes
0answers
36 views

Speed up login after changing user name datastore type to VARBINARY from VARCHAR

We have a project underway that requires the import of ~6 million users into Drupal (Core 7x) that have many (150K+) case-insensitive duplicate usernames. Importing these users with existing case and ...
0
votes
0answers
107 views

Unbuffered query errors and conflict in access to the database

I've been developing on Drupal at work for some time, now I also have a hosted personal site (on fastcomet). The first install was with 8.6 and php 7.2, then it has been idle for a while, now I ...
0
votes
1answer
95 views

fetchAll Database query returns an error

I'm building a REST Resource in drupal 8 php that returns the result of a query to the database. However using the fetchAssoc() only returns one result. So I figured that fetchAll() returns all ...
1
vote
1answer
45 views

How do I get the number of rows affected from an update query?

I'm having trouble figuring out how to get the number of affected rows from an update query in Drupal. I have a form where users can update their profile details. Now, not every user is going to ...
1
vote
0answers
54 views

Database password revealed in PHP error_log?

Noticed some errors while updating to Drupal 8.9.11. As I'm reviewing I come across the following. Replaced the actual password with PASSWORD below. Is this intentional or a bug? I can't see why the ...
1
vote
1answer
33 views

List all node titles to better iterate on a list of names

I have a content type called Country and I have to verify what countries already exists in db and save the missing ones, comparing to a variable with all countries ($country_list). I am having trouble ...
0
votes
0answers
34 views

How to display or make the cities selectable in address module?

I'd like to set for users on Drupal 9-Website on the registration form and for some content-types a new field "Address". I did activate module "address" and added new field to user ...
0
votes
0answers
20 views

hook_update_N column addition - error

I am adding 2 columns to an existing table using hook_update_N function as below: function cca_update_8904(&$sandbox){ $connection = \Drupal::database(); $schema = $connection->schema(...
2
votes
2answers
283 views

How can I query by node title?

In Drupal 7 I had this code to query node fields and its respective title: $query = db_select('node', 'n'); $query->join('field_data_field_internal_institute_paper_i', 'iipi', 'n.nid = iipi....
1
vote
1answer
210 views

How to update Drupal custom module after changing .install file

I am working on a pre-created Drupal 8 project that has a custom module called CCA(named out of project title). I have done the below update in the .install file to add a new column to the backend via ...

1
2 3 4 5
62