mcpField
E
embedded-sql

embedded-sql

github.com/thalysjuvenalData & databases19151 installsUpdated 6w ago
Repository

About embedded-sql

A skill for developers writing, reviewing, or modernizing SQL in ADVPL/TLPP. It explains `BeginSQL` macros, query patterns, safety constraints, and when to use `TCSqlExec` for data changes.

Key features

  1. 01`BeginSQL` syntax and macros
  2. 02JOIN, aggregation, and subquery patterns
  3. 03Safe variable binding and row filters
  4. 04Migration from concatenated `TCQuery` SQL
  5. 05DML guidance with `TCSqlExec`

Use cases

  1. 01Writing a new ADVPL/TLPP query
  2. 02Reviewing SQL for safety and correctness
  3. 03Converting legacy `TCQuery` strings
  4. 04Choosing an approach for INSERT, UPDATE, or DELETE

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/thalysjuvenal/advpl-specialist --skill embedded-sql

After installing, type/embedded-sqlin Claude Code to confirm it loaded.

Bundled filesreference.md

Details

From the project README

Embedded SQL in ADVPL/TLPP

This skill covers writing SQL inside ADVPL/TLPP using BeginSQL ... EndSQL blocks and their special macro expressions -- %table:TABLE% for physical table resolution, %xfilial:TABLE% for branch filtering, %notDel% for logical-deletion filtering, %exp:EXPRESSION% for safe variable binding, and %Order:TABLE% for primary-key ordering. It also covers column type declarations, JOIN and aggregation patterns, subqueries, and migrating legacy TCQuery string-concatenation code to Embedded SQL.

Activate this skill whenever the user is writing a new query, reviewing an existing one for correctness/safety, or converting old concatenated-string SQL to the modern BeginSQL syntax. It also covers the restrictions and gotchas of BeginSQL (no * at line start, always include %notDel% and filial filtering, use GetNextAlias(), close aliases) and when to use TCSqlExec instead for INSERT/UPDATE/DELETE.

It does not cover general native function lookups unrelated to SQL (see protheus-reference), business-process context for which tables/fields to query (see protheus-business), or generating documentation for a routine that happens to contain SQL (see documentation-patterns).

Reference fileRead when
reference.mdAlways -- BeginSQL syntax, macro expressions, JOIN/aggregation/subquery patterns, DML via TCSqlExec, performance tips, and TCQuery migration

Comments

Markdown supported