dbal

Doctrine DBAL setParameter() with array value

被刻印的时光 ゝ 提交于 2019-12-03 11:30:20
I'm using doctrine DBAL and have some problem with SQL query as result of a queryBuilder. $builder = $this->getConnection()->getQueryBuilder(); $builder->select(['id','name','type']) ->from('table') ->where('id='.(int)$value) ->setMaxResults(1); $builder->andWhere($builder->expr()->in('type', ['first','second'])); echo(builder->getSQL()); $data = $builder->execute()->fetchRow(); And get SQL SELECT id, name, type FROM table WHERE (id=149) AND (type IN (first,second)) LIMIT 1 And this is the problem, I need that (type IN (first,second)) was encoded as strings like (type IN ('first','second'))

D语言(Dlang)ORM

眉间皱痕 提交于 2019-12-03 09:47:20
前言 为了让Dlang像 Java / PHP / C# 一样具有非常好的数据库操作体验,我们了解了 PDO、JDBC、HIBERNATE、ADO.NET,最终发现大家的设计都不是很统一,只有 Java 最新的持久化标准 JPA 是真正的具有可移植性,所以我们准备自己实现一套 JPA 机制,命名为 dlang-entity。 分析 分析的时候发现 dlang 官方没有任何标准的数据库操作接口,也就是像 PDO / JDBC / ADO.NET 这样的东东都不存在…… 继续分析发现上层还有 SQL BUILDER ,最上层还有 Entity 的一系列管理,最终我们把 ORM 分成了 4 个层,分别是 Database / DBAL / CriteriaQuery/ Entity 层次功能 Database 负责基础的数据库访问,接收 SQL 语句,类似于 PDO、JDBC、ADO.NET; DBAL 负责实现 SQL BUILDER,依赖 Database; CriteriaQuery 是调用 DBAL 层,和 Entity 的实体进行关系绑定; Entity 见名之意就是实体,下面依赖 DBAL 和 CriteriaQuery。 难点分析 上面的架构是分层实现,但是对于功能来说是从外而内,Database 和 Entity 是同步设计的,目前参考了 JPA 的接口设计

Symfony : how to set SSL parameters in Doctrine DBAL configuration (YAML)?

社会主义新天地 提交于 2019-12-03 08:51:34
I'd like to add my SSL cert and key files to Doctrine DBAL configuration but I don't see how to achieve that. In PHP, I just have to write something like : $databaseHandler = new \PDO( 'mysql:host=my_host;dbname=my_db', 'username', 'password', array( \PDO::MYSQL_ATTR_SSL_KEY => '.../client-key.pem', \PDO::MYSQL_ATTR_SSL_CERT => '.../client-cert.pem', \PDO::MYSQL_ATTR_SSL_CA => '.../ca-cert.pem' ) ); I understand there is a Custom Driver Option driverOptions , and I saw this answer but I'm not sure about how to translate that into YAML. I have the feeling I should write something close to :

Missing insert() method on Doctrine DBAL Query Builder

青春壹個敷衍的年華 提交于 2019-12-01 18:34:53
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 QueryBuilder page from the DBAL Documantation The \Doctrine\DBAL\Query\QueryBuilder supports building SELECT, INSERT, UPDATE and DELETE queries. Which sort of query you are building depends on the methods you are using. It goes on further to explain code examples, such that I can simply do: $builder = $connection->createQueryBuilder(); $result = $builder -

Symfony 2 SQLSTATE[HY000] [2002] Connection refused Error

青春壹個敷衍的年華 提交于 2019-11-28 23:26:48
I get an error like database operations using Symfony2. SQLSTATE[HY000] [2002] Connection refused parameters.yml parameters: database_driver: pdo_mysql database_host: 127.0.0.1 database_port: '8889' database_name: symfony database_user: root database_password: root mailer_transport: smtp mailer_host: 127.0.0.1 mailer_user: null mailer_password: null locale: tr secret: ef9b4381fe75208f060b7c786951242bebcfb3c2 database_path: /private/var/mysql/mysql.sock And console: Kemal-Karakass-MacBook-Pro:~ kemalkarakas$ locate mysql.sock /private/var/mysql/mysql.sock How do I resolve the error? There is a

What is the difference between Database Abstraction Layer & Data Access Layer?

可紊 提交于 2019-11-28 17:02:28
I am actually stuck in 3-tier structure. I surfed the internet and found two terminologies "Database Abstraction Layer" & "Data Access Layer". What are the differences between the two? Lotus Notes My understanding is that a data access layer does not actually abstract the database, but rather makes database operations and query building easier. For example, data access layers usually have APIs very similar to SQL syntax that still require knowledge of the database's structure in order to write: $Users->select('name,email,datejoined')->where('rank > 0')->limit(10); Data abstraction layers are

What is the difference between Database Abstraction Layer & Data Access Layer?

本秂侑毒 提交于 2019-11-27 10:00:39
问题 I am actually stuck in 3-tier structure. I surfed the internet and found two terminologies "Database Abstraction Layer" & "Data Access Layer". What are the differences between the two? 回答1: My understanding is that a data access layer does not actually abstract the database, but rather makes database operations and query building easier. For example, data access layers usually have APIs very similar to SQL syntax that still require knowledge of the database's structure in order to write: