diff --git a/README.md b/README.md index 7fbc25a12..1a8c84be3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- YiiFramework + Yii

Yii Database

@@ -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. @@ -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. diff --git a/composer.json b/composer.json index 1637cdeb7..1afd0d508 100644 --- a/composer.json +++ b/composer.json @@ -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": "*", diff --git a/docs/guide/en/README.md b/docs/guide/en/README.md index f531cd9cd..2fe6ece88 100644 --- a/docs/guide/en/README.md +++ b/docs/guide/en/README.md @@ -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 @@ -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 diff --git a/docs/guide/en/command/ddl.md b/docs/guide/en/command/ddl.md index eb808e99d..62c1bd047 100644 --- a/docs/guide/en/command/ddl.md +++ b/docs/guide/en/command/ddl.md @@ -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 @@ -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 @@ -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. @@ -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. @@ -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. > @@ -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`. @@ -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. diff --git a/docs/guide/en/connection/logger.md b/docs/guide/en/connection/logger.md index 81b760592..4b48fc92b 100644 --- a/docs/guide/en/connection/logger.md +++ b/docs/guide/en/connection/logger.md @@ -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 diff --git a/docs/guide/en/connection/profiler.md b/docs/guide/en/connection/profiler.md index ec9c6fd18..9a7f83039 100644 --- a/docs/guide/en/connection/profiler.md +++ b/docs/guide/en/connection/profiler.md @@ -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. diff --git a/docs/guide/en/queries/execute-command.md b/docs/guide/en/queries/execute-command.md index fd6dc67e7..f8a251bfc 100644 --- a/docs/guide/en/queries/execute-command.md +++ b/docs/guide/en/queries/execute-command.md @@ -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: diff --git a/docs/guide/en/queries/transactions.md b/docs/guide/en/queries/transactions.md index f32c66317..16dac369c 100644 --- a/docs/guide/en/queries/transactions.md +++ b/docs/guide/en/queries/transactions.md @@ -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. diff --git a/docs/guide/en/query-builder.md b/docs/guide/en/query-builder.md index a3ca5ca20..94261849e 100644 --- a/docs/guide/en/query-builder.md +++ b/docs/guide/en/query-builder.md @@ -45,4 +45,4 @@ LIMIT 10 ## Usage -- [Building queries](docs/guide/en/query-builder/building-queries.md). +- [Building queries](query-builder/building-queries.md). diff --git a/docs/guide/en/query-builder/building-queries.md b/docs/guide/en/query-builder/building-queries.md index c62d27eab..4db82167b 100644 --- a/docs/guide/en/query-builder/building-queries.md +++ b/docs/guide/en/query-builder/building-queries.md @@ -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) diff --git a/docs/guide/en/query/having.md b/docs/guide/en/query/having.md index 56f4e3a30..bd8681acf 100644 --- a/docs/guide/en/query/having.md +++ b/docs/guide/en/query/having.md @@ -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. diff --git a/docs/guide/en/query/with-query.md b/docs/guide/en/query/with-query.md index 02a06c8f9..b1aec3c1c 100644 --- a/docs/guide/en/query/with-query.md +++ b/docs/guide/en/query/with-query.md @@ -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. diff --git a/docs/guide/en/schema/cache.md b/docs/guide/en/schema/cache.md index 304b65aa5..76d6121b9 100644 --- a/docs/guide/en/schema/cache.md +++ b/docs/guide/en/schema/cache.md @@ -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 diff --git a/docs/guide/pt-BR/README.md b/docs/guide/pt-BR/README.md index 6b06bd86d..c8024a9cb 100644 --- a/docs/guide/pt-BR/README.md +++ b/docs/guide/pt-BR/README.md @@ -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 @@ -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) diff --git a/docs/guide/pt-BR/command/ddl.md b/docs/guide/pt-BR/command/ddl.md index 84649806b..82d22cf7f 100644 --- a/docs/guide/pt-BR/command/ddl.md +++ b/docs/guide/pt-BR/command/ddl.md @@ -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. @@ -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 @@ -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 @@ -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: @@ -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. @@ -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. @@ -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. > @@ -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`. @@ -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. > diff --git a/docs/guide/pt-BR/connection/logger.md b/docs/guide/pt-BR/connection/logger.md index 85ccc42c5..1a683789f 100644 --- a/docs/guide/pt-BR/connection/logger.md +++ b/docs/guide/pt-BR/connection/logger.md @@ -52,7 +52,7 @@ return [ ]; ``` -Para outros DBMS, consulte a seção ["Criar conexão"](/docs/guide/pt-BR/README.md#criar-conexão). +Para outros DBMS, consulte a seção ["Criar conexão"](../README.md#criar-conexão). ## Uso avançado do Logger diff --git a/docs/guide/pt-BR/connection/profiler.md b/docs/guide/pt-BR/connection/profiler.md index a7040b261..3edb54177 100644 --- a/docs/guide/pt-BR/connection/profiler.md +++ b/docs/guide/pt-BR/connection/profiler.md @@ -54,4 +54,4 @@ return [ ]; ``` -Para outros DBMS, consulte a seção ["Criar conexão"](/docs/guide/pt-BR/README.md#criar-conexão). +Para outros DBMS, consulte a seção ["Criar conexão"](../README.md#criar-conexão). diff --git a/docs/guide/pt-BR/queries/execute-command.md b/docs/guide/pt-BR/queries/execute-command.md index 4aec8ab93..120ccde46 100644 --- a/docs/guide/pt-BR/queries/execute-command.md +++ b/docs/guide/pt-BR/queries/execute-command.md @@ -1,6 +1,6 @@ # Executar um comando -Todos os métodos introduzidos em [Criar um comando e buscar dados](create-command-fetch-data.md) lidam com +Todos os métodos introduzidos em [criar um comando e buscar dados](create-command-fetch-data.md) lidam com consultas `SELECT` que buscam dados de bancos de dados. Para consultas que não retornam nenhum dado, você deve chamar o método `Yiisoft\Db\Command\CommandInterface::execute()`: diff --git a/docs/guide/pt-BR/queries/transactions.md b/docs/guide/pt-BR/queries/transactions.md index 011e58ad9..a55e51280 100644 --- a/docs/guide/pt-BR/queries/transactions.md +++ b/docs/guide/pt-BR/queries/transactions.md @@ -1,4 +1,4 @@ -# Executar muitos comandos em uma transação +# Executar vários comandos em uma transação Para que os dados sejam consistentes quando vários comandos estiverem envolvidos, você pode usar transações. diff --git a/docs/guide/pt-BR/query-builder.md b/docs/guide/pt-BR/query-builder.md index 8d87f8a75..52f9005cc 100644 --- a/docs/guide/pt-BR/query-builder.md +++ b/docs/guide/pt-BR/query-builder.md @@ -28,7 +28,7 @@ $rows = (new Query($db)) ->all(); ``` -O código acima gera e executa a seguinte consulta SQL, onde o parâmetro `:last_name` está vinculado a +O código acima gera e executa a seguinte consulta SQL, onde o parâmetro `:last_name` está vinculado à string `Smith`: ```sql @@ -45,4 +45,4 @@ LIMIT 10 ## Uso -- [Construindo consultas](/docs/guide/pt-BR/query-builder/building-queries.md). +- [Construindo consultas](query-builder/building-queries.md). diff --git a/docs/guide/pt-BR/query-builder/building-queries.md b/docs/guide/pt-BR/query-builder/building-queries.md index ea36eee50..18f415fec 100644 --- a/docs/guide/pt-BR/query-builder/building-queries.md +++ b/docs/guide/pt-BR/query-builder/building-queries.md @@ -7,33 +7,33 @@ Os nomes desses métodos são semelhantes às **palavras-chaves SQL** usadas nas Por exemplo, para especificar a parte `FROM` de uma **consulta SQL**, você chamaria o método `Yiisoft\Db\Query\Query::from()`. Todos os métodos de construção de consulta retornam o próprio objeto de consulta, o que permite encadear muitas chamadas. -- [Select](/docs/guide/pt-BR/query/select.md) -- [From](/docs/guide/pt-BR/query/from.md) -- [Where](/docs/guide/pt-BR/query/where.md) - - [Formato string](/docs/guide/pt-BR/query/where.md#formato-string) - - [Formato hash](/docs/guide/pt-BR/query/where.md#formato-hash) - - [Formato operador](/docs/guide/pt-BR/query/where.md#formato-operador) - - [and](/docs/guide/pt-BR/query/where.md#and) - - [or](/docs/guide/pt-BR/query/where.md#or) - - [not](/docs/guide/pt-BR/query/where.md#not) - - [between](/docs/guide/pt-BR/query/where.md#between) - - [not between](/docs/guide/pt-BR/query/where.md#not-between) - - [in](/docs/guide/pt-BR/query/where.md#in) - - [not in](/docs/guide/pt-BR/query/where.md#not-in) - - [like](/docs/guide/pt-BR/query/where.md#like) - - [or like](/docs/guide/pt-BR/query/where.md#or-like) - - [not like](/docs/guide/pt-BR/query/where.md#not-like) - - [or not like](/docs/guide/pt-BR/query/where.md#or-not-like) - - [exists](/docs/guide/pt-BR/query/where.md#exists) - - [not exists](/docs/guide/pt-BR/query/where.md#not-exists) - - [comparison](/docs/guide/pt-BR/query/where.md#comparison) - - [Formato objeto](/docs/guide/pt-BR/query/where.md#formato-objeto) - - [Anexando condições](/docs/guide/pt-BR/query/where.md#anexando-condições) - - [Condições de filtro](/docs/guide/pt-BR/query/where.md#condições-de-filtro) -- [OrderBy](/docs/guide/pt-BR/query/order-by.md) -- [GroupBy](/docs/guide/pt-BR/query/group-by.md) -- [Having](/docs/guide/pt-BR/query/having.md) -- [Limit and Offset](/docs/guide/pt-BR/query/limit-and-offset.md) -- [Join](/docs/guide/pt-BR/query/join.md) -- [Union](/docs/guide/pt-BR/query/union.md) -- [WithQuery](/docs/guide/pt-BR/query/with-query.md) +- [Select](../query/select.md) +- [From](../query/from.md) +- [Where](../query/where.md) + - [Formato string](../query/where.md#formato-string) + - [Formato hash](../query/where.md#formato-hash) + - [Formato operador](../query/where.md#formato-operador) + - [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) + - [Formato objeto](../query/where.md#formato-objeto) + - [Anexando condições](../query/where.md#anexando-condições) + - [Condições de filtro](../query/where.md#condições-de-filtro) +- [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) diff --git a/docs/guide/pt-BR/query/having.md b/docs/guide/pt-BR/query/having.md index 2e6066ca9..cbcc87e64 100644 --- a/docs/guide/pt-BR/query/having.md +++ b/docs/guide/pt-BR/query/having.md @@ -15,7 +15,7 @@ A parte relevante do SQL é: HAVING `status` = 1 ``` -Consulte a documentação de [Where](/docs/guide/pt-BR/query/where.md) para obter mais detalhes sobre como especificar uma condição. +Consulte a documentação de [Where](where.md) para obter mais detalhes sobre como especificar uma condição. Você pode chamar `Yiisoft\Db\Query\Query::andHaving()` ou `Yiisoft\Db\Query\Query::orHaving()` para anexar mais condições para o fragmento `HAVING`. diff --git a/docs/guide/pt-BR/query/with-query.md b/docs/guide/pt-BR/query/with-query.md index 35bb3ab80..5d34929cf 100644 --- a/docs/guide/pt-BR/query/with-query.md +++ b/docs/guide/pt-BR/query/with-query.md @@ -2,7 +2,7 @@ O método `\Yiisoft\Db\Query\Query::withQuery()` especifica o prefixo `WITH` de uma consulta SQL. Você pode usá-lo em vez da subconsulta para obter mais legibilidade e alguns recursos exclusivos (CTE recursivo). -[Leia mais em SQL moderno](https://modern-sql.com/). +[Leia mais em Modern SQL](https://modern-sql.com/). Por exemplo, esta consulta selecionará todas as permissões aninhadas de admin com seus filhos recursivamente. diff --git a/docs/guide/pt-BR/schema/cache.md b/docs/guide/pt-BR/schema/cache.md index ebeb86446..04ab63866 100644 --- a/docs/guide/pt-BR/schema/cache.md +++ b/docs/guide/pt-BR/schema/cache.md @@ -10,13 +10,13 @@ informações de esquema do banco de dados em [SchemaCache](https://github.com/y Quando o [Schema](https://github.com/yiisoft/db/blob/master/src/Schema/AbstractSchema.php) precisa recuperar informações sobre o esquema do banco de dados, primeiro ele verifica o cache. -Você pode configurar [SchemaCache](https://github.com/yiisoft/db/blob/master/src/Cache/SchemaCache.php) para usar +Você pode configurar [SchemaCache](https://github.com/yiisoft/db/blob/master/src/Cache/SchemaCache.php) para usar a [Implementação de cache PSR-16](https://github.com/php-fig/simple-cache) de duas maneiras: - Usar a ligação automática do [contêiner DI](https://github.com/yiisoft/di). - Configurá-lo manualmente. -Os exemplos abaixo usam [yiisoft/cache](https://github.com/yiisoft/cache). Certifique-se de tê-lo instalado via Composer +Os exemplos abaixo usam [yiisoft/cache](https://github.com/yiisoft/cache). Certifique-se de tê-lo instalado via [Composer](https://getcomposer.org) usando `composer require yiisoft/cache`. ## Cache PSR-16 com conexão automática diff --git a/docs/internals.md b/docs/internals.md index ba6f53a30..1d151b86e 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -1,5 +1,11 @@ # Internals +## Github actions + +All our packages have github actions by default, so you can test your [contribution](https://github.com/yiisoft/db/blob/master/.github/CONTRIBUTING.md) in the cloud. + +> Note: We recommend pull requesting in draft mode until all tests pass. + ## Unit testing This package can be tested globally or individually for each DBMS. @@ -10,12 +16,6 @@ This package can be tested globally or individually for each DBMS. - [PostgreSQL](https://github.com/yiisoft/db-pgsql) - [SQLite](https://github.com/yiisoft/db-sqlite) -### Github actions - -All our packages have github actions by default, so you can test your [contribution](https://github.com/yiisoft/db/blob/master/.github/CONTRIBUTING.md) in the cloud. - -> Note: We recommend pull requesting in draft mode until all tests pass. - ### Docker images For greater ease it is recommended to use Docker containers for each DBMS, for this you can use the [docker-compose.yml](https://docs.docker.com/compose/compose-file/) file that in the root directory of each package. @@ -34,7 +34,7 @@ docker compose up -d ### Global testing -The package is tested with [PHPUnit](https://phpunit.de/). To run tests: +The following steps are required to run the tests. 1. Run all Docker containers for each DBMS. 2. Install the dependencies of the project with composer. @@ -46,7 +46,7 @@ The package is tested with [PHPUnit](https://phpunit.de/). To run tests: ### Individual testing -The package is tested with [PHPUnit](https://phpunit.de/). To run tests: +The following steps are required to run the tests. 1. Run the Docker container for the dbms you want to test. 2. Install the dependencies of the project with composer.