# 数据库方言

### 添加依赖

```xml
<dependency>
    <groupId>win.doyto</groupId>
    <artifactId>doyto-query-dialect</artifactId>
    <version>${doyto-query.version}</version>
</dependency>
```

### 配置方式

#### 方式一: 文件配置

```yml
doyto:
  query:
    config:
      dialect: win.doyto.query.dialect.PostgreSQLDialect
```

#### 方式二：静态方法设置

```java
GlobalConfiguration.instance().setDialect(new HSQLDBDialect());
```

### 数据库支持

| Database   | Dialect                                   |
| ---------- | ----------------------------------------- |
| HSQLDB     | win.doyto.query.dialect.HSQLDBDialect     |
| MySQL 5    | win.doyto.query.dialect.MySQLDialect      |
| MySQL 8    | win.doyto.query.dialect.MySQL8Dialect     |
| Oracle     | win.doyto.query.dialect.OracleDialect     |
| PostgreSQL | win.doyto.query.dialect.PostgreSQLDialect |
| SQL Server | win.doyto.query.dialect.SQLServerDialect  |
| SQLite     | win.doyto.query.dialect.SQLiteDialect     |

### 接口说明

{% code title="Dialect.java" %}

```java
package win.doyto.query.core;

public interface Dialect {
    String buildPageSql(String sql, int limit, long offset);
    default String wrapLabel(String fieldName) {
        return fieldName;
    }
    // Other methods..
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://query.docs.doyto.win/zh/pei-zhi/dialect.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
