Questions tagged [dbal]

Database Abstraction Layer for Doctrine ORM (PHP)

Database abstraction layer with many features for database schema introspection, schema management and PDO abstraction.

261 questions
4
votes
2 answers

How to replace (not add) properties during Import in Shopware 6?

We are using Shopware 6.3.5 and want to replace properties during import (update) of products. We specifiy to product ID and the list or property UUIDs (in the column properties) Currently, those get added to the existing properties in the…
Alex
  • 32,506
  • 16
  • 106
  • 171
4
votes
0 answers

what the alternative of FETCH_KEY_PAIR if it is deprecated in Doctrine DBAL 3.0

It was very convenient tool to fetch data from SELECT as $id => $value in result: $result = $this->conn->executeQuery("SELECT id, value, FROM table")->fetch(PDO::FETCH_KEY_PAIR); , but now I have an ERROR: Using a PDO fetch mode or their…
4
votes
1 answer

What is the way with PHP to sanitize user input for SQL DDL statement?

I need to update a user's password from PHP, this is accomplished through an ALTER USER statement. I can't use prepared statements, because they do not support DDL commands. The username field can be easily sanitized my making sure it matches an…
Ryan Slama
  • 43
  • 4
4
votes
2 answers

How to migration change columns type?

I got an error, When I try to column type from string to text, With migration function of Laravel. File : {data_time}_change_db_structure.php public function up() { Schema::table('service_request_type', function (Blueprint $table) { …
ThunderBirdsX3
  • 558
  • 1
  • 9
  • 25
4
votes
1 answer

DBAL Querybuilder not updating

I am trying to update a record with the DBAL Query builder and it does not seem to be working. The data column that I am trying to set will only work if I replace the test example value I have here with a number. In that case it will update my…
Stephan-v
  • 19,255
  • 31
  • 115
  • 201
4
votes
2 answers

Doctrine DBAL ->execute() and Hydration with DB2 field names including '#'

I'm trying to implement a model/mapper type of interaction using Doctrine DBAL but ran into a few questions. Some of my column names have a '#' at the end. Changing the name is not an option. The ${'COL1#'} syntax works fine for regular variables,…
d.lanza38
  • 2,525
  • 7
  • 30
  • 52
4
votes
0 answers

How to test Doctrine DBAL connection is successful

In my webapp, I am going to accept all the database connection parameters (such as username, server, database etc.) as input from the users and before saving those information, I want to quickly test if a connection can be obtained successfully…
4
votes
1 answer

Should I manually close DB Connection and Statement's cursor's after a fetch?

I'm building something with Silex and Doctrine DBAL using a Mysql database. I was wondering if it considered best practice to close the cursor of a statement and database connection after one's done it. For example: $sql = ' SELECT …
Tieme
  • 62,602
  • 20
  • 102
  • 156
4
votes
1 answer

Error handling in Doctrine DBAL with comparison to PHP PDO

With PDO we have \PDO::ATTR_ERRMODE, and with setting it to \PDO::ERRMODE_EXCEPTION we are able to get detailed exception stack trace (getTrace). How it's with DBAL? How to set in DBAL level of how it throw errors? DBAL is a wrapper around the PDO…
BlueMark
  • 962
  • 4
  • 23
  • 41
4
votes
1 answer

PostgreSQL advisory locks are not working with Doctrine's DBAL

I'm experiencing a very strange behavior when trying to use advisory locks in Doctrine's DBAL. I have a Symfony 2 application in which I want to obtain an advisory lock for some entity. I'm making the following query to obtain the lock: SELECT…
Slava Fomin II
  • 26,865
  • 29
  • 124
  • 202
4
votes
4 answers

Symfony console application: dependency injection

A Symfony novice here. After reading some of the Symfony documentation and some answers here at SO, I am now almost completely confused. I am trying to use the console application component and create a small db-aware console application. Many…
Yuri Makassiouk
  • 425
  • 3
  • 16
4
votes
1 answer

Missing insert() method on Doctrine DBAL Query Builder

I feel like I'm having a moment where I'm missing something small here; I've been having issues using the insert() method on the QueryBuilder component on Dotrine DBAL 2.2.x / 2.3.x. I did some investigation and here's the snippet from the…
Aren
  • 54,668
  • 9
  • 68
  • 101
4
votes
3 answers

Enabling Doctrine DBAL commands in Symfony app/console

When using bare-bone Doctrine with the command line that comes out of the box there are two commands available that don't seem to be available with using Doctrine with Symfony and the app/console: dbal dbal:import Import SQL file(s) directly to…
Luke
  • 20,878
  • 35
  • 119
  • 178
4
votes
1 answer

Can Doctrine DBAL do batch inserts?

Is it possible to do batch inserts using Doctrine DBAL against a SQLite DB? i.e make the following more efficient: $twitter = new TwitterAPIExchange($twitterAuth); $response = json_decode($twitter->setGetfield($getField) …
codecowboy
  • 9,835
  • 18
  • 79
  • 134
4
votes
2 answers

Limit sql result on dbal

Im using dbal on Symfony2 to retrieve some info from my table: $social = $conn->fetchAll('SELECT * FROM page WHERE brand_id = :brand LIMIT :start,:limit', array('brand'=>$brand, 'start'=>(int) $start, 'limit'=>(int) $limit)); Im getting an error…
DomingoSL
  • 14,920
  • 24
  • 99
  • 173
1 2
3
17 18