> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/client-interfaces/ecpg/ecpg-descriptors/ecpg-sqlda-descriptors/ecpg-sqlda-data-structures/ecpg-sqlda-sqlvar.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 34.7.2.1.2. sqlvar\_t 結構

### 34.7.2.1.2. sqlvar\_t 結構 [#](#ecpg-sqlda-sqlvar) <a href="#ecpg-sqlda-sqlvar" id="ecpg-sqlda-sqlvar"></a>

結構型別 `sqlvar_t` 存放一個欄位的值，以及型別與長度等中繼資料。此型別的定義如下：

```

struct sqlvar_struct
{
    short          sqltype;
    short          sqllen;
    char          *sqldata;
    short         *sqlind;
    struct sqlname sqlname;
};

typedef struct sqlvar_struct sqlvar_t;
```

各欄位的意義如下：

#### `sqltype` [#](#ecpg-sqlda-sqlvar-sqltype) <a href="#ecpg-sqlda-sqlvar-sqltype" id="ecpg-sqlda-sqlvar-sqltype"></a>

包含欄位的型別識別碼。可能的值請參閱 `ecpgtype.h` 中的 `enum ECPGttype`。

#### `sqllen` [#](#ecpg-sqlda-sqlvar-sqllen) <a href="#ecpg-sqlda-sqlvar-sqllen" id="ecpg-sqlda-sqlvar-sqllen"></a>

包含欄位的二進位長度，例如 `ECPGt_int` 為 4 個位元組。

#### `sqldata` [#](#ecpg-sqlda-sqlvar-sqldata) <a href="#ecpg-sqlda-sqlvar-sqldata" id="ecpg-sqlda-sqlvar-sqldata"></a>

指向資料。資料的格式說明請參閱[第 34.4.4 節](https://docs.postgresql.tw/19/client-interfaces/ecpg/ecpg-variables/ecpg-variables-type-mapping.md#ecpg-variables-type-mapping)。

#### `sqlind` [#](#ecpg-sqlda-sqlvar-sqlind) <a href="#ecpg-sqlda-sqlvar-sqlind" id="ecpg-sqlda-sqlvar-sqlind"></a>

指向空值指示值。0 表示非空值，-1 表示空值。

#### `sqlname` [#](#ecpg-sqlda-sqlvar-sqlname) <a href="#ecpg-sqlda-sqlvar-sqlname" id="ecpg-sqlda-sqlvar-sqlname"></a>

欄位的名稱。

[返回 34.7.2.1. SQLDA 資料結構](https://docs.postgresql.tw/19/client-interfaces/ecpg/ecpg-descriptors/ecpg-sqlda-descriptors/ecpg-sqlda-data-structures.md#ecpg-sqlda-descriptors-sqlda)。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/ecpg-descriptors.html)（原文版本：18.6；核對日期：2026-10-23）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/client-interfaces/ecpg/ecpg-descriptors/ecpg-sqlda-descriptors/ecpg-sqlda-data-structures/ecpg-sqlda-sqlvar.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
