Skip to content

Commit

Permalink
Update file (#848)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru>
  • Loading branch information
luizcmarin and vjik committed May 16, 2024
1 parent 0acb116 commit beedc6b
Show file tree
Hide file tree
Showing 25 changed files with 136 additions and 130 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center" style="text-align: center">
<a href="https://github.com/yiisoft" target="_blank">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px" alt="YiiFramework">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px" alt="Yii">
</a>
<h1 align="center">Yii Database</h1>
</p>
Expand All @@ -13,7 +13,7 @@
[![type-coverage](https://shepherd.dev/github/yiisoft/db/coverage.svg)](https://shepherd.dev/github/yiisoft/db)

Yii Database is a framework-agnostic package to work with different types of databases,
such as [MariaDB], [MSSQL], [MySQL], [Oracle], [PostgreSQL] and [SQLite].
such as [MariaDB](https://mariadb.org), [MySQL](https://www.mysql.com), [MSSQL](https://www.microsoft.com/sql-server), [Oracle](https://www.oracle.com/database), [PostgreSQL](https://www.postgresql.org) and [SQLite](https://www.sqlite.org).

Using the package, you can perform common database tasks such as creating, reading, updating, and deleting
records in a database table, as well as executing raw SQL queries.
Expand All @@ -30,18 +30,10 @@ $rows = (new Query($db))
The package is designed to be flexible
and can be extended to support extra database types or to customize the way it interacts with databases.

There is an [ActiveRecord] implementation built on top of it.
There is an [ActiveRecord](https://github.com/yiisoft/active-record) implementation built on top of it.
It allows interacting with database tables using objects,
similar to the way you would use ORM (Object-Relational Mapping) frameworks like Doctrine or Hibernate.

[ActiveRecord]: https://github.com/yiisoft/active-record
[MariaDB]: https://mariadb.org
[MSSQL]: https://www.microsoft.com/sql-server
[MySQL]: https://www.mysql.com
[Oracle]: https://www.oracle.com/database
[PostgreSQL]: https://www.postgresql.org
[SQLite]: https://www.sqlite.org

## Requirements

- PHP 8.0 or higher.
Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/db/issues/issues?state=open",
"source": "https://github.com/yiisoft/db",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "ircs://irc.libera.chat:6697/yii",
"chat": "https://t.me/yii3en",
"source": "https://github.com/yiisoft/db"
"chat": "https://t.me/yii3en"
},
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/yiisoft"
},
{
"type": "github",
"url": "https://github.com/sponsors/yiisoft"
}
],
"require": {
"php": "^8.0",
"ext-ctype": "*",
Expand Down
16 changes: 9 additions & 7 deletions docs/guide/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ create a database agnostic application.

Yii DB supports the following databases out of the box:

- [MSSQL](https://www.microsoft.com/en-us/sql-server/sql-server-2019) of versions **2017, 2019, 2022**.
- [MySQL](https://www.mysql.com/) of versions **5.7 - 8.0**.
- [MariaDB](https://mariadb.org/) of versions **10.4 - 10.9**.
- [Oracle](https://www.oracle.com/database/) of versions **12c - 21c**.
- [PostgreSQL](https://www.postgresql.org/) of versions **9.6 - 15**.
- [SQLite](https://www.sqlite.org/) of version **3.3 and above**.
| DB | Version |
|----|----------|
| [MSSQL](https://www.microsoft.com/en-us/sql-server/sql-server-2019) | **2017, 2019, 2022** |
| [MySQL](https://www.mysql.com/) | **5.7 - 8.0** |
| [MariaDB](https://mariadb.org/) | **10.4 - 10.9** |
| [Oracle](https://www.oracle.com/database/) | **12c - 21c** |
| [PostgreSQL](https://www.postgresql.org/) | **9.6 - 15** |
| [SQLite](https://www.sqlite.org/) | **3.3 or higher** |

## Installation

Expand Down Expand Up @@ -71,7 +73,7 @@ You can create a database connection instance using a [DI container](https://git
- [PostgreSQL Server](connection/pgsql.md)
- [SQLite Server](connection/sqlite.md)

> Info: When you create a DB connection instance, the actual connection to the database isn't established until
> Note: When you create a DB connection instance, the actual connection to the database isn't established until
> you execute the first SQL or call the `Yiisoft\Db\Connection\ConnectionInterface::open()` method explicitly.
### Logger and profiler
Expand Down
14 changes: 7 additions & 7 deletions docs/guide/en/command/ddl.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->dropTable('{{%customer}}')->execute();
```

> Warning: All existing data will be deleted.
> **Warning:** All existing data will be deleted.
### Truncate a table

Expand All @@ -78,7 +78,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->truncateTable('{{%customer}}')->execute();
```

> Warning: All existing data will be deleted.
> **Warning:** All existing data will be deleted.
## Columns

Expand Down Expand Up @@ -251,7 +251,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'UNIQUE')->execute();
```

> Info: Unique indexes are indexes that help maintain data integrity by ensuring that no rows of data in a table have identical
> Note: Unique indexes are indexes that help maintain data integrity by ensuring that no rows of data in a table have identical
> key values.
> When you create a unique index for an existing table with data, values in the columns or expressions that comprise the
> index key are checked for uniqueness.
Expand All @@ -267,7 +267,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'CLUSTERED')->execute();
```

> Info: A clustered index is an index which defines the physical order in which table records are stored in a database.
> Note: A clustered index is an index which defines the physical order in which table records are stored in a database.
> Since there can be only one way in which records are physically stored in a database table, there can be only one
> clustered index per table. By default a clustered index is created on a primary key column.
Expand All @@ -282,7 +282,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'NONCLUSTERED')->execute();
```

> Info: A non-clustered index is also used to speed up search operations. Unlike a clustered index, a non-clustered index doesn’t
> Note: A non-clustered index is also used to speed up search operations. Unlike a clustered index, a non-clustered index doesn’t
> physically define the order in which records are inserted into a table. In fact, a non-clustered index is stored in a
> separate location from the data table.
>
Expand All @@ -301,7 +301,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'name', 'FULLTEXT')->execute();
```

> Info: Full-text indexes are created on text-based columns (`CHAR`, `VARCHAR`, or `TEXT` columns) to speed up queries and DML operations
> Note: Full-text indexes are created on text-based columns (`CHAR`, `VARCHAR`, or `TEXT` columns) to speed up queries and DML operations
> on data contained within those columns.
>
> A full-text index is defined as part of a `CREATE TABLE` statement or added to an existing table using `ALTER TABLE` or `CREATE INDEX`.
Expand All @@ -318,7 +318,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'BITMAP')->execute();
```

> Info: A bitmap index is a special kind of database index which uses bitmaps or bit array. In a bitmap index, Oracle stores a
> Note: A bitmap index is a special kind of database index which uses bitmaps or bit array. In a bitmap index, Oracle stores a
> bitmap for each index key.
>
> Each index key stores pointers to multiple rows. For example, if you create a bitmap index on the gender column of the members table.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/connection/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ return [
];
```

For other DBMS refer to ["Create connecton"](/docs/guide/en/README.md#create-connection) section.
For other DBMS refer to ["Create connecton"](../README.md#create-connection) section.

## Advanced usage of Logger

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/connection/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ return [
];
```

For other DBMS refer to ["Create connection"](/docs/guide/en/README.md#create-connection) section.
For other DBMS refer to ["Create connection"](../README.md#create-connection) section.
2 changes: 1 addition & 1 deletion docs/guide/en/queries/execute-command.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Execute a command

All methods introduced in the [Create a command and fetch data](create-command-fetch-data.md) deal with
All methods introduced in the [create a command and fetch data](create-command-fetch-data.md) deal with
`SELECT` queries which fetch data from databases.

For queries that don't return any data, you should call the `Yiisoft\Db\Command\CommandInterface::execute()` method:
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/queries/transactions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Execute many commands in a transaction
# Execute several commands in a transaction

In order for the data to be consistent when multiple commands are involved, you can use transactions.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/query-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ LIMIT 10
## Usage

- [Building queries](docs/guide/en/query-builder/building-queries.md).
- [Building queries](query-builder/building-queries.md).
60 changes: 30 additions & 30 deletions docs/guide/en/query-builder/building-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ The names of these methods resemble the **SQL keywords** used in the correspondi
For example, to specify the `FROM` part of a **SQL query**, you would call the `Yiisoft\Db\Query\Query::from()` method.
All the query building methods return the query object itself, which allows you to chain many calls together.

- [Select](/docs/guide/en/query/select.md)
- [From](/docs/guide/en/query/from.md)
- [Where](/docs/guide/en/query/where.md)
- [String format](/docs/guide/en/query/where.md#string-format)
- [Hash format](/docs/guide/en/query/where.md#hash-format)
- [Operator format](/docs/guide/en/query/where.md#operator-format)
- [and](/docs/guide/en/query/where.md#and)
- [or](/docs/guide/en/query/where.md#or)
- [not](/docs/guide/en/query/where.md#not)
- [between](/docs/guide/en/query/where.md#between)
- [not between](/docs/guide/en/query/where.md#not-between)
- [in](/docs/guide/en/query/where.md#in)
- [not in](/docs/guide/en/query/where.md#not-in)
- [like](/docs/guide/en/query/where.md#like)
- [or like](/docs/guide/en/query/where.md#or-like)
- [not like](/docs/guide/en/query/where.md#not-like)
- [or not like](/docs/guide/en/query/where.md#or-not-like)
- [exists](/docs/guide/en/query/where.md#exists)
- [not exists](/docs/guide/en/query/where.md#not-exists)
- [comparison](/docs/guide/en/query/where.md#comparison)
- [Object format](/docs/guide/en/query/where.md#object-format)
- [Appending conditions](/docs/guide/en/query/where.md#appending-conditions)
- [Filter conditions](/docs/guide/en/query/where.md#filter-conditions)
- [OrderBy](/docs/guide/en/query/order-by.md)
- [GroupBy](/docs/guide/en/query/group-by.md)
- [Having](/docs/guide/en/query/having.md)
- [Limit and Offset](/docs/guide/en/query/limit-and-offset.md)
- [Join](/docs/guide/en/query/join.md)
- [Union](/docs/guide/en/query/union.md)
- [WithQuery](/docs/guide/en/query/with-query.md)
- [Select](../query/select.md)
- [From](../query/from.md)
- [Where](../query/where.md)
- [String format](../query/where.md#string-format)
- [Hash format](../query/where.md#hash-format)
- [Operator format](../query/where.md#operator-format)
- [and](../query/where.md#and)
- [or](../query/where.md#or)
- [not](../query/where.md#not)
- [between](../query/where.md#between)
- [not between](../query/where.md#not-between)
- [in](../query/where.md#in)
- [not in](../query/where.md#not-in)
- [like](../query/where.md#like)
- [or like](../query/where.md#or-like)
- [not like](../query/where.md#not-like)
- [or not like](../query/where.md#or-not-like)
- [exists](../query/where.md#exists)
- [not exists](../query/where.md#not-exists)
- [comparison](../query/where.md#comparison)
- [Object format](../query/where.md#object-format)
- [Appending conditions](../query/where.md#appending-conditions)
- [Filter conditions](../query/where.md#filter-conditions)
- [OrderBy](../query/order-by.md)
- [GroupBy](../query/group-by.md)
- [Having](../query/having.md)
- [Limit and Offset](../query/limit-and-offset.md)
- [Join](../query/join.md)
- [Union](../query/union.md)
- [WithQuery](../query/with-query.md)
2 changes: 1 addition & 1 deletion docs/guide/en/query/having.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The relevant part of SQL is:
HAVING `status` = 1
```

Refer to the documentation for [Where](/docs/guide/en/query/where.md) for more details about how to specify a condition.
Refer to the documentation for [Where](where.md) for more details about how to specify a condition.

You can call `Yiisoft\Db\Query\Query::andHaving()` or `Yiisoft\Db\Query\Query::orHaving()` to append more conditions
to the `HAVING` fragment.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/query/with-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The `\Yiisoft\Db\Query\Query::withQuery()` method specifies the `WITH` prefix of a SQL query.
You can use it instead of subquery for more readability and some unique features (recursive CTE).
[Read more at modern SQL](https://modern-sql.com/).
[Read more at Modern SQL](https://modern-sql.com/).

For example, this query will select all nested permissions of admin with their children recursively.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/schema/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can configure [SchemaCache](https://github.com/yiisoft/db/blob/master/src/Ca
- Use [DI container](https://github.com/yiisoft/di) autowiring.
- Configure it manually.

Examples below use [yiisoft/cache](https://github.com/yiisoft/cache). Make sure you have installed it via Composer
Examples below use [yiisoft/cache](https://github.com/yiisoft/cache). Make sure you have installed it via [Composer](https://getcomposer.org)
using `composer require yiisoft/cache`.

## Autowired PSR-16 cache
Expand Down
16 changes: 9 additions & 7 deletions docs/guide/pt-BR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ criar um aplicativo independente de banco de dados.

Yii DB suporta os seguintes bancos de dados prontos para uso:

- [MSSQL](https://www.microsoft.com/en-us/sql-server/sql-server-2019) das versões **2017, 2019, 2022**.
- [MySQL](https://www.mysql.com/) das versões **5.7 - 8.0**.
- [MariaDB](https://mariadb.org/) das versões **10.4 - 10.9**.
- [Oracle](https://www.oracle.com/database/) das versões **12c - 21c**.
- [PostgreSQL](https://www.postgresql.org/) das versões **9.6 - 15**.
- [SQLite](https://www.sqlite.org/) da versão **3.3 e superior**.
| DB | Versões |
|----|---------|
| [MSSQL](https://www.microsoft.com/en-us/sql-server/sql-server-2019) | **2017, 2019, 2022** |
| [MySQL](https://www.mysql.com/) | **5.7 - 8.0** |
| [MariaDB](https://mariadb.org/) | **10.4 - 10.9** |
| [Oracle](https://www.oracle.com/database/) | **12c - 21c** |
| [PostgreSQL](https://www.postgresql.org/) | **9.6 - 15** |
| [SQLite](https://www.sqlite.org/) | **3.3 e superior** |

## Installation

Expand Down Expand Up @@ -71,7 +73,7 @@ Você pode criar uma instância de conexão de banco de dados usando um [contêi
- [Servidor PostgreSQL](connection/pgsql.md)
- [Servidor SQLite](connection/sqlite.md)

> Info: Quando você cria uma instância de conexão de banco de dados, a conexão real com o banco de dados não é estabelecida até
> Nota: Quando você cria uma instância de conexão de banco de dados, a conexão real com o banco de dados não é estabelecida até
> você executar o primeiro SQL ou chamar o método `Yiisoft\Db\Connection\ConnectionInterface::open()` explicitamente.
### Logger e profiler (criador de perfil)
Expand Down
20 changes: 10 additions & 10 deletions docs/guide/pt-BR/command/ddl.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Comandos de linguagem de definição de dados (DDL)
# Comandos de Linguagem de Definição de Dados (DDL)

Linguagem de definição de dados (DDL) é um conjunto de instruções SQL para definir a estrutura do banco de dados.
Linguagem de Definição de Dados (DDL) é um conjunto de instruções SQL para definir a estrutura do banco de dados.

Instruções DDL são usadas para criar e alterar os objetos de banco de dados em um banco de dados.
Esses objetos podem ser tabelas, índices, visualizações, procedimentos armazenados, gatilhos e assim por diante.
Expand Down Expand Up @@ -64,7 +64,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->dropTable('{{%customer}}')->execute();
```

> Aviso: Todos os dados existentes serão excluídos.
> **Aviso:** Todos os dados existentes serão excluídos.
### Truncar uma tabela

Expand All @@ -78,7 +78,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->truncateTable('{{%customer}}')->execute();
```

> Aviso: Todos os dados existentes serão excluídos.
> **Aviso:** Todos os dados existentes serão excluídos.
## Colunas

Expand Down Expand Up @@ -236,7 +236,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->dropIndex('{{%customer}}', 'idx-customer-name')->execute();
```

### Adicionar índice exclusivo
### Adicionar um índice exclusivo

Você pode criar um índice único especificando a opção `UNIQUE` no parâmetro `$indexType`, é suportado por todos SGBDs:

Expand All @@ -247,7 +247,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'UNIQUE')->execute();
```

> Info: índices exclusivos são índices que ajudam a manter a integridade dos dados, garantindo que nenhuma linha de dados em uma tabela tenha valores idênticos nos valores da chave.
> Nota: índices exclusivos são índices que ajudam a manter a integridade dos dados, garantindo que nenhuma linha de dados em uma tabela tenha valores idênticos nos valores da chave.
> Quando você cria um índice exclusivo para uma tabela existente com dados, valores nas colunas ou expressões que compõem a
> chave de índice são verificadas quanto à exclusividade.
Expand All @@ -262,7 +262,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'CLUSTERED')->execute();
```

> Info: Um índice clusterizado é um índice que define a ordem física na qual os registros da tabela são armazenados em um banco de dados.
> Nota: Um índice clusterizado é um índice que define a ordem física na qual os registros da tabela são armazenados em um banco de dados.
> Como só pode haver uma maneira pela qual os registros são armazenados fisicamente em uma tabela de banco de dados, só pode haver um
> índice clusterizado por tabela. Por padrão, um índice clusterizado é criado em uma coluna de chave primária.
Expand All @@ -277,7 +277,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'NONCLUSTERED')->execute();
```

> Info: Um índice não clusterizado também é usado para acelerar as operações de pesquisa. Ao contrário de um índice clusterizado, um índice não clusterizado não
> Nota: Um índice não clusterizado também é usado para acelerar as operações de pesquisa. Ao contrário de um índice clusterizado, um índice não clusterizado não
> define fisicamente a ordem em que os registros são inseridos em uma tabela. Na verdade, um índice não clusterizado é armazenado em um
> local separado da tabela de dados.
>
Expand All @@ -295,7 +295,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'name', 'FULLTEXT')->execute();
```

> Info: índices de texto completo são criados em colunas baseadas em texto (colunas `CHAR`, `VARCHAR` ou `TEXT`) para acelerar consultas e operações DML
> Nota: índices de texto completo são criados em colunas baseadas em texto (colunas `CHAR`, `VARCHAR` ou `TEXT`) para acelerar consultas e operações DML
> nos dados contidos nessas colunas.
>
> Um índice de texto completo é definido como parte de uma instrução `CREATE TABLE` ou adicionado a uma tabela existente usando `ALTER TABLE` ou `CREATE INDEX`.
Expand All @@ -312,7 +312,7 @@ use Yiisoft\Db\Connection\ConnectionInterface;
$db->createCommand()->createIndex('test', 'idx_test_name', 'id', 'BITMAP')->execute();
```

> Info: Um índice de bitmap é uma especificação
> Nota: Um índice de bitmap é uma especificação
tipo especial de índice de banco de dados que usa bitmaps ou matriz de bits. No índice de bitmap, o Oracle armazena um
> bitmap para cada chave de índice.
>
Expand Down

0 comments on commit beedc6b

Please sign in to comment.