Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
v-dem committed Sep 6, 2024
1 parent 3234d60 commit 7d244c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0d4762b3b45e48c69d13687cd786e0ca)](https://app.codacy.com/manual/v-dem/queasy-db?utm_source=github.com&utm_medium=referral&utm_content=v-dem/queasy-db&utm_campaign=Badge_Grade_Dashboard)
[![Build Status](https://travis-ci.com/v-dem/queasy-db.svg?branch=master)](https://travis-ci.com/v-dem/queasy-db)
[![codecov](https://codecov.io/gh/v-dem/queasy-db/branch/master/graph/badge.svg)](https://codecov.io/gh/v-dem/queasy-db)
[![Total Downloads](https://poser.pugx.org/v-dem/queasy-db/downloads)](https://packagist.org/packages/v-dem/queasy-db)
[![License](https://poser.pugx.org/v-dem/queasy-db/license)](https://packagist.org/packages/v-dem/queasy-db)
Expand All @@ -8,32 +7,38 @@

## Package `v-dem/queasy-db`

Database access classes. Some the most usual queries can be built automatically, more complex queries can be
added into database and/or tables config.
QuEasy DB is a set of database access classes for CRUD operations.
Some of the most usual queries can be built automatically (like `SELECT` by unique field value/values, `UPDATE`, `INSERT` and `DELETE`).
Complex queries can be defined in database and/or tables config.
The main goal is to move `SQL` queries out of `PHP` code.

### Features

* QuEasy DB extends `PDO` class, so any project which uses `PDO` can be seamlessly moved to use QuEasy DB.
* CRUD database operations in just one PHP code row.
* Separating SQL queries from PHP code.

### Requirements

* PHP version 5.3 or higher

### Installation

composer require v-dem/queasy-db:master-dev
composer require v-dem/queasy-db

It will also install `v-dem/queasy-helper`.

### Usage

#### Notes

* `queasy\db\Db` class inherits `PDO` class, so any `PDO` methods can be called with it
* You can use `setLogger()` method which accepts `Psr\Log\LoggerInterface` to log all queries
* You can use `setLogger()` method which accepts `Psr\Log\LoggerInterface` to log all queries, by default `Psr\Log\NullLogger` is used.
* By default error mode is set to `PDO::ERRMODE_EXCEPTION` (as in PHP8) if another mode is not set in `$options`.

#### IMPORTANT!
##### IMPORTANT!

* For MySQL Server need to set option `PDO::MYSQL_ATTR_INIT_COMMAND` to `SET GLOBAL SQL_MODE=ANSI_QUOTES`.
* For MS SQL Server similar: `SET QUOTED_IDENTIFIER O`.
* For MSSQL Server need to run `$db->run('SET QUOTED_IDENTIFIER O');`.

#### Initialization

Expand Down Expand Up @@ -75,8 +80,6 @@ Or PDO-way:
$db = new queasy\db\Db('pgsql:host=localhost;dbname=test', 'test_user', 'test_password');
```

* By default error mode is set to `PDO::ERRMODE_EXCEPTION`

#### Get all records from `users` table

```php
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"homepage": "https://github.com/v-dem/queasy-db/",
"keywords": ["database", "pdo", "mysql", "postgresql", "sqlite", "pdo wrapper", "crud"],
"license": "LGPL-3.0-only",
"version": "1.0.0",
"version": "1.1.0",
"minimum-stability": "dev",
"authors": [
{
Expand All @@ -19,7 +19,7 @@
"php": ">=5.3.0",
"ext-pdo": "*",
"psr/log": "1.0.1",
"v-dem/queasy-helper": "dev-master"
"v-dem/queasy-helper": "1.*"
},
"require-dev": {
"php": ">=7.1.0",
Expand Down

0 comments on commit 7d244c6

Please sign in to comment.