This skill provides comprehensive guidance for writing, refactoring, and auditing SQL within ADVPL and TLPP source code for the Totvs Protheus ERP. It specializes in implementing the modern BeginSql/EndSql syntax, ensuring multi-company and multi-branch compatibility through mandatory macros like %notDel% and %xfilial%. By enforcing Protheus-specific performance and security standards, such as rules PERF-001 through PERF-003 and SQL-001, it helps developers transition legacy TCQuery concatenations into modern, safe, and performant database operations while avoiding common pitfalls like unclosed cursors or cross-branch data leaks.
主な機能
01Automated generation of BeginSql/EndSql blocks with mandatory Protheus macros
0213 GitHub stars
03Bulk DML implementation using TCSqlExec with transaction safety checks
04Proactive linting for SQL injection, cross-branch leaks, and deleted record filtering
05Automated data typing for query columns using TCSetField and MPSysOpenQuery
06Refactoring legacy TCQuery and RetSqlName concatenations into modern embedded SQL
ユースケース
01Auditing existing ADVPL code for performance bottlenecks like SELECT * or missing soft-delete filters
02Converting legacy string-concatenated SQL queries to modern, secure BeginSql syntax
03Writing high-performance, multi-tenant database updates that respect Protheus branch filters