germanfndez

oxmysql

OxMySQL for FiveM — SQL integrations with MySQL/MariaDB. Use when writing or editing server-side database code: queries, inserts, updates, transactions, or any resource that uses oxmysql (query, insert, prepare, update, single, scalar, rawExecute, transaction). Docs: https://coxdocs.dev/oxmysql

germanfndez 6 2 Updated 3mo ago

Resources

1
GitHub

Install

npx skillscat add germanfndez/fiveai-skills/oxmysql

Install via the SkillsCat registry.

SKILL.md

OxMySQL

SQL integration for FiveM using OxMySQL (replacement for mysql-async / ghmattimysql). Server-side only. Use MariaDB over MySQL 8 for compatibility.

When to use

  • User asks for database queries, inserts, updates, or SQL in a FiveM resource.
  • Editing or writing code that uses MySQL.* or exports.oxmysql.
  • Designing tables, upserts, or transactions.

Setup

  • Lua: server_script '@oxmysql/lib/MySQL.lua' in fxmanifest (above other scripts).

Rules

Read the rule that matches what you're doing:

  • rules/placeholders.md — Safe parameters (? placeholders), avoid SQL injection.
  • rules/query.mdMySQL.query / MySQL.query.await: SELECT returns rows; other statements return insertId/affectedRows.
  • rules/insert.mdMySQL.insert: insert row, returns insert id.
  • rules/prepare.mdMySQL.prepare: prepared statements, only ? placeholders; faster for repeated queries.
  • rules/update.mdMySQL.update: update rows, returns affected count.
  • rules/single.mdMySQL.single: one row or nil.
  • rules/scalar.mdMySQL.scalar: single value (one row, one column).
  • rules/rawExecute.mdMySQL.rawExecute: raw execution, no automatic result shape.
  • rules/transaction.mdMySQL.transaction: run multiple queries in a transaction.

References (look up if not covered in the rules above)

If something isn't covered in the rules above, check the official docs: