Questions tagged [database]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
16 views

add a pdf generator [closed]

here is my question. in a custom module i want to add a button which returns a pdf file (with records from database). I can't use composer cause of using shared hosting. any ideas how can add this ...
0
votes
0answers
12 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 (...
-1
votes
0answers
30 views

General error: 2 File '/code/sites/default/files/myfile/myfile.csv' not found (Errcode: 2) insert csv record in DB

I am getting an error while inserting CSV records in the database. It was working fine before, but now it doesn't. I am using MySQL 10.0.23-MariaDB-log. Drupal\Core\Database\DatabaseExceptionWrapper: ...
0
votes
0answers
12 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']) ...
5
votes
1answer
52 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
36 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 ...
0
votes
0answers
31 views

How can I fix this error I have when doing an update.php?

I have a Drupal 8 site under a Nginx server. I suspect that this problem is about the Ngnix configuration but I'm not sure. When I run update.php the problem displays under /update.php/selection ...
1
vote
1answer
23 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
1answer
29 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
19 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
33 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
22 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 ...
0
votes
2answers
35 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
93 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
29 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
30 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
41 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
36 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
35 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
33 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
28 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
21 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
27 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
32 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
25 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
19 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
88 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
106 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 ...
4
votes
1answer
68 views

Force a single value base field to be in a separate table?

I have a custom entity type (eg: myentitytype), and I would like to add a new base field to it via hook_entity_base_field_info(). As I understand it, single value fields (with a cardinality of 1) will ...
0
votes
1answer
57 views

Why isn't a PDO driver detected on the install page?

I have an old Drupal 7 project and I need to set it up on my localhost. I have Ubuntu 16.04, Apache 2, php 7.0, and MySQL 5.7 installed. Everything is working fine for other PHP scripts, But when I ...
1
vote
2answers
80 views

How to run custom sql commands to database programatically

I'm using MariaDB as database backend and I would like to use built in "Sequences" to get an integer number generator. I need to dinamically create sequences and get their values. Following ...
1
vote
2answers
46 views

How to make a case sensitive entity query?

My custom entity type comes with a string field for which I would prefer case sensitive queries. When I use $query = \Drupal::entityQuery('my_entity_type') ->condition('my_token_field', '...
1
vote
2answers
194 views

LogicException: The database connection is not serializable - when I try to open any “gear” on checkout flow page?

So I'm on Commerce -> Configuration -> Orders -> Checkout flows. I'm editing a flow (it's the same with any of them), so i.e. I'm at page: /admin/commerce/config/checkout-flows/manage/...
0
votes
2answers
70 views

How do I edit serialized values in “config” and “key_value” tables?

While trying to switch original language of a Commerce product type I've encountered longblob serialized data in config and key_value database tables. Is there a quick way to edit them, possibly ...
-6
votes
2answers
60 views

Is it possible to import an SQL file? [closed]

I have an SQL database created from another application and I would like to add it to my existing Drupal 8 site. I didn't find a way to do so. I came across the Data module, but I have no idea how to ...
0
votes
1answer
52 views

How should I get data from the node table?

I am creating a Drupal Dashboard (PHP 7.2, Drupal 8.9). I'm trying to query the node table using the following code. $database = \Drupal::database(); $query = $database->query("SELECT ...
0
votes
0answers
42 views

How to install drupal 9 with PostgreSQL using Docksal?

I use docksal for developing on Drupal. Recently I decided to install Drupal 9 with PostgreSQL as a database using Docksal. Firstly, I cloned this git-repository. https://github.com/docksal/...
0
votes
1answer
31 views

Extracting user field values from dynamic SQL queries

Aim I have successfully written a fairly long dynamic sql query, however am struggling with a seemingly simple part at the end. Although, I am able to successfully extract mail and name from the users ...
0
votes
0answers
40 views

Override core files database, statement, connection

I'm trying to turns things in everyway in order to override those core files: Database, Statement & Connection in order to build a simple array of SQLQueries along with their results in order to ...
1
vote
0answers
34 views

Database dump without revisions?

Are there methods to exclude revision data in a database dump? The purpose would be to reduce the file size for developers that want a db dump for local development. I know that drush sql-dump has an ...
0
votes
0answers
41 views

Rollbacking from Yaml based configuration to database based configuration

We recently changed the way we deploy our Drupal site on our testing environment to a docker image. The issue is that we were using a file based configuration. The current applied configuration is not ...
0
votes
0answers
33 views

how to download media into drupal 9 database from a sql database

here my problem i have old blog made in laravel and my boss want me to migrate all the article to a drupal website so i create a plugin that migrate the article title and text but i have to download ...
0
votes
0answers
10 views

How do I restore/recreate accounts created using OpenID after restoring from a backup?

After performing a rollback of our Drupal 7 site, we realized we had 20 - 30 users that were "lost". Looking for the most efficient / possible (?) way to recreate those users with the least ...
1
vote
0answers
110 views

Is it safe to truncate the key_value_expire table?

I am seeing over 8 GB in the database for the key_value_expire table. Is it safe to manually truncate that table? This appears to be caused by a bug in the Honeypot Module, which I am unable to ...
0
votes
0answers
14 views

How to update value of single field of same node using node_save?

The problem statement: I have one content type called 'Employee' which has 10 nodes. I have to perform the voting for each node. I am saving the vote count in the field called 'vote count'. But when ...
0
votes
0answers
27 views

migration plugin works but fail to migrate in drupal database

I try to migrate old blog article to a drupal website here is my migration class : class Article extends SqlBase { /** *{@inheritDoc} */ public function query() { $query = $this->...
0
votes
0answers
82 views

Why my Migration don't reckognize my plugin in drupal 9

I'm new in drupal and I try to migrate the article of an old blog with sql database to my drupal 9 project. I follow the instruction give by the drupal API migration docs, so i connect the 2 database ...
0
votes
0answers
61 views

What is the correct way to use an in-memory sqlite database for Unittests?

I have found vague hints on the internet that we can speed up Unittests with an in-memory database by using the following line in our phpunit.xml file: <env name="SIMPLETEST_DB" value=&...
0
votes
0answers
16 views

Drupal EntityFieldQuery() returns partial result set

I have used the following code to return the vids of all the playlists associated with a particular program. $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', '...
0
votes
1answer
31 views

where in database is renamed login for 'Rename Admin Paths"

A little embarrassing - I've lost/forgotten the login page for a Drupal 8.9 website. It was renamed using the module "Rename Admin Paths." I've gone to the module page at drupal.org and ...

1
2 3 4 5
62