Execute DML
kb_executeExecute INSERT, UPDATE, or DELETE statements on KingBase database and return affected row count. Supports parameterized queries for safe value substitution.
Instructions
Execute a DML statement (INSERT, UPDATE, DELETE) against the KingBase database.
Returns the number of affected rows. Use parameterized queries ($1, $2, ...) for safe value substitution.
š Auto-schema feature: Unqualified table names (without schema prefix) are automatically qualified with the configured schema (DB_SCHEMA env var). You can optionally override this with the 'schema' parameter.
Args:
sql (string): The DML statement to execute
params (array, optional): Parameter values for $1, $2, ... placeholders
schema (string, optional): Override the default schema for auto-qualifying table names
Returns: Number of rows affected by the operation.
Examples:
sql: "UPDATE users SET status = $1 WHERE id = $2", params: ["inactive", 123]
sql: "INSERT INTO users (name, email) VALUES ($1, $2)", params: ["John", "john@example.com"]
sql: "DELETE FROM logs WHERE created_at < $1", params: ["2024-01-01"]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | DML statement (INSERT/UPDATE/DELETE) to execute | |
| params | No | Optional parameterized query values ($1, $2, ...) | |
| schema | No | Schema name for tables without explicit schema prefix (default: from DB_SCHEMA env or 'public') |