Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [database]

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

0
votes
0answers
4 views

addExpression combining CASE and CONCAT

I have a D8 query where i join several tables and use addexpression with CASE to make a new conditional field. So far so good. For one of the WHEN conditions I need to construct this field from two ...
2
votes
1answer
16 views

Using the fetch() method in database query to get an array

I have a very simple query that does the job, to get a collection of a specific content type's node id and title, that's it. $connection = \Drupal::database(); $query = $connection->select('...
0
votes
0answers
15 views

Drupal 8 Install.php mysql connection fails

I am unable to connect to mysql database during application install. I am able to connect to mysql from shell though mysql --protocol=TCP -u dbadmin -p # this works. I recreated the user and ...
0
votes
0answers
17 views

Where is webforms template info stored in the database

I'm using webforms in Drupal 8. I have migrated an old database over but need to overwrite the correct webforms table to restore a webform template I created on a previous site. Can you tell me ...
-5
votes
0answers
13 views

Connection with MSSQL Error [closed]

Getting this error when we are performing any write operation from Drupal in mssql db. [09-Jan-2019 16:49:13 UTC] PHP Fatal error: Uncaught Error: Cannot instantiate abstract class DatabaseSchema in ...
0
votes
2answers
32 views

Which method is more efficient, database query or taxonomy term controller?

I tried to find a method to verify if the current taxonomy item page has a parent or children, now I get two but I don't know which one is better for the efficiency. approach I: use taxonomy item ...
-2
votes
0answers
40 views

How to store and pull custom entity's from a second database in drupal

Hello friends :) I am very new to Drupal development so please take it easy on me. I have been tasked to set up a eCommerce platform on using Drupal 8. The catch is that my boss has requested the all ...
2
votes
1answer
24 views

Database 4 byte UTF-8 support not properly checking

In the status report of my drupal website I got the message that I had to up Database 4 byte UTF-8 support. I updated all my tables and database like it's told here: https://www.drupal.org/node/...
0
votes
0answers
33 views

Cannot Login to my website - “Website encountered an unexpected error”. Logout works fine [closed]

The moment I login to my Drupal 8.6.5 website, I get the error page. /user/logout brings back the website. I have cleared the caches using phpMyAdmin. Also tried to install Drush and use drush cr ...
-1
votes
2answers
71 views

Database Insert Slower On Production Server [closed]

I recently upgraded the PHP version to 7.1 on my production server. I also updated my local to 7.1 and staging to 7.1. Only on production, I am seeing a slow down when I import a csv file and insert ...
1
vote
1answer
27 views

Programmatically alter a field collection field item not yet saved in the database

Updating field collection field item gives error when one item is added. I have the following code which works well when just changing values of a field already saved in the database but if I add a ...
0
votes
0answers
34 views

Share tables across two databases with two different users

I can't get my head around this. Maybe someone can give me a suggestion. I have two Drupal 6 instances in two different folders. Each is using its own DB. All i want is to share some tables from the ...
1
vote
2answers
38 views

How to get image path in view? [closed]

I have created a content type having two fields: Title Image (multiple image field) Then I create a page view for the same. Added these two fields. Now I have to create an external theming in view ...
1
vote
1answer
28 views

How can i use MATCH and AGAINST with db_select?

I have a query like: $query = db_query(" SELECT *, MATCH(field1,field2) AGAINST ('$s' IN BOOLEAN MODE) AS Relevance FROM {my_table} ORDER BY Relevance DESC, created DESC "); That ...
1
vote
0answers
26 views

entityQuery where a translation with a different value returns incorrect nodes

The title seems a bit odd, I know, but I couldn't find any issues similar to this and that's the best I could come up with. We are running into an odd instance of entityQuery returning nodes that ...
0
votes
1answer
13 views

How to display my array values in nested array of type stdClass Object

i am having trouble figuring out how to render my array fields values for specific fields. So far i've managed to query my db and collect the node values and save it to my cart of items. However, i am ...
0
votes
1answer
16 views

Finding entity/webform fields in the database

A bunch of user accounts were deleted and recreated with new UIDs, and so any webform submissions or entities that have fields pointing to the old UID are now broken/wrong. I already updated some UID ...
0
votes
2answers
24 views

Drupal db select IN, group by count

need a bit of help please, when i write my query like this it works fine $query = db_query('select * from form_submissions where address in (select address from form_submissions group by address ...
0
votes
0answers
18 views

If field name is end with underscore example field_data_my_field____ in Drupal 8 than what issue or failure can come

Suppose if I have created some field in content type example: node field . machine name (field_node_filed__) So what is the draw back of fields machine name is ending with (_) underscore. Is it ...
0
votes
0answers
20 views

Updating the delta value on a custom field

I have a content type with an image field and I am trying to update the delta value. I'm assuming the delta value is used to sort the images when they're rendered. (If there is a better way please ...
0
votes
1answer
137 views

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: [duplicate]

After entering some custom fields, I went to /content and now I am getting the following error: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. I've tried the following with no ...
0
votes
0answers
23 views

Menus, drush uli link, and some images not working after moving site to localhost

I've just gotten a site I'm supposed to do some work on but I'm having trouble with migrating to a local development environment. I don't have admin access to the site itself, but I do have access to ...
-1
votes
0answers
40 views

Cannot db_select join extra taxonomy term

I have 4 taxonomy term fields with a total of 400 terms, and I have to query the input field from node/add reference field against the database. $query = db_select('entityform','e') ->fields('e'...
0
votes
1answer
25 views

Conditional clauses with Entity field Query

I have a syntax issue on using conditional clauses with EFQ, but the documentation on drupal.org is a bit unclear for me. I have google the whole Internet for this with no results at all. My hook ...
1
vote
0answers
11 views

Select locale translation info from non-default database

I setup 2 databases connections in settings.php, one is MySQL on which Drupal is installed and running, the other is Oracle from which sometimes reading some info non-relevant to Drupal as below: ...
0
votes
1answer
22 views

How do i select all from database and do while loop with them

I did this easy select and im getting Error: Call to a member function fetchAssoc() on boolean , im beginner, im just trying to pull out two variables and make operations with them. $result = ...
1
vote
0answers
34 views

Optimize custom database queries

I am building my first Drupal 8 module and wondering how to optimize work with multiple queries to the database? $query = \Drupal::database(); $transaction = $query->startTransaction(); $product = ...
0
votes
0answers
14 views

How to get / pull unique values from Database and not duplicates?

I have a multi-site and a database full of values that are identical, with the only thing separating them apart is the type of site. For example: Site1 = Myvalue1 Site2 = Myvalue1 Site1 = Myvalue2 ...
3
votes
1answer
161 views

Per Bundle Storage for Drupal 8?

In Drupal 7 there was the start of Per-Bundle Storage (PBS) to try to store field data in a single database table if that made sense and was possible given the nature of the field. The PBS for Drupal ...
-1
votes
1answer
15 views

How can I add an array or a new value to the query condition? [closed]

I need to add a new type of content in my query condition, but I don't know how to do it. This is the code I am using. $query_result = $query->getQuery() ->condition('type','series'+ .........
-1
votes
1answer
104 views

Invalid parameter number: number of bound variables does not match number of tokens: SELECT 1 AS expression

Good Morning I get this error: Invalid parameter number: number of bound variables does not match number of tokens: SELECT 1 AS expression (edited) I need to insert an array of values into a field ...
1
vote
1answer
65 views

basics of settings.php and settings.local.php?

What is the up-to-date basic workflow regarding database credentials when you launch a local version of a site that is already operating remotely? What are the considerations and how is each best ...
1
vote
0answers
27 views

Caching and Mysql binary logs [closed]

In my recent Drupal 8 project, we have the master-slave setup and we face binary-log files getting generated to a huge amount for every hour. On decoding these binary log files we figured out a lot of ...
0
votes
1answer
27 views

How to group by one field

I have a view which shows the users subscribed to the website. Some users have multiple roles, therefore, on the results, there are some duplicates. What I want to do is to remove these duplicates, ...
0
votes
1answer
53 views

Render entity fields retrieved by EntityQuery

I'm building a table with TableSort retrieved by EntityQuery like explained in this post. The result fields vary a lot and I have a hard time to figure out how to render the results of the different ...
0
votes
1answer
59 views

EntityQuery on nodes related by ERR and paragraphs

I have content type Publication which relates to content type Project using paragraphs: Publication [field_mention] -> Mention (paragraphs) [field_project] -> Project Now I want to show all ...
0
votes
1answer
27 views

How to add a column to DB with weight by using hook_update_N?

I want to add a column to a database by using hook_update_N(), but it should be 3rd column instead of last column. How I can achieve that please help in this regard. I tried to add weight but not ...
0
votes
1answer
38 views

How do I order a search query by best match?

I am using the following code. $query = \Drupal::entityQuery('node'); $query->condition('status', 1); $query->condition('type', 'article'); for ($i = 0; $i < count($split_keys); $i++){ ...
0
votes
1answer
37 views

Can't clean URL from custom query parameters

I have a client whose company has different branches. The data are retrieved from a DB (not the Drupal one). For example, the url mydrupalsite.com/branch?branchID=1 should lead to mydrupalsite.com/...
1
vote
1answer
33 views

How can I have separate databases for each domain (countries) of my Drupal website?

I want to have one Drupal website codebase and one apache server instance, but have each country (domain) have it's own database. Practical example: I want all content to be completely separated ...
2
votes
1answer
32 views

“Experimental modules found: Place blocks” but I am using core 8.6

I am using Drupal 8.6.2. When I open the status report I see the following warning: Experimental modules found: Place Blocks. Experimental modules are provided for testing purposes only. Use at ...
1
vote
1answer
103 views

How to update the database schema without losing existing data

I have a custom module with my_module.install file defining my two data tables in mysql. Module is already installed and I am able to save data from forms into them. Now my requirements changed and I ...
0
votes
0answers
11 views

Unexpected behavior when searching the result of a database query

I have a simplesamlphp_auth hook to alter the users allowed to login via the federated login. Inside of this hook, namely hook_simplesamlphp_auth_allow_login(), I make a static database query like so, ...
0
votes
0answers
90 views

How can I tell Drupal to skip a failed DB update instruction?

when updating from 8.5.x to 8.6.1, an error happened when running one of the database update instructions. More precisely, the error occurs when Drupal is trying to run function taxonomy_update_8502()....
0
votes
1answer
21 views

Is db_set_active a global or local setting?

I need to run a new query on another database. I configured the settings.php $databases = array ( 'default' => array ( 'default' => array ( 'database' =...
0
votes
1answer
52 views

Querying a custom table does not return latest results for anonymous user

I have a custom module and a simple custom table in the database. When I try to query the table to get the row, it seems Drupal 8, or maybe mysql, is caching the results. $connection = \Drupal::...
0
votes
1answer
32 views

How to specify AND, OR with dynamic query

I’m trying to create a dynamic query, the query logic conditions needed are: AND, and OR. The main query will include two sub queries. The ConditionInterface::condition documentation states that: ...
0
votes
0answers
15 views

Change date field; how to add timezone handling later

About date fields, this page https://www.drupal.org/node/767182 says If you start off without a time zone, but then realize that you need one at a later date [...] Perform the switch in the ...
0
votes
2answers
100 views

How to use between date query?

I have 2 fields in a node and I'm trying to get the expired nodes set in "Start Date" and "End Date" field. I'm using db_select to get the start and end date values. How can I add a condition to ...
0
votes
1answer
24 views

Dont save webform data to database

For SPECIFIC webforms, how can I make it not save data to the database, but just send the email? It should however still save the files and link to them in the email. Idk if I can use something like ...