Skip to content
Proyek

Tentang

MySQL resource for FXServer.

Data dan analisis

Cara angka ini diukur

Yang dapat Anda lakukan

  • Support for mysql-async and ghmattimysql syntax.
  • Promises / async query handling allowing for non-blocking and awaitable responses.
  • Improved performance and stability compared to other options.
  • Support for named and unnamed placeholders, improving performance and security.

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
-1
dalam 15 hari
0
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

oxmysql

A FiveM resource to communicate with a MySQL database using node-mysql2.


Refer to CONTRIBUTING.md for contribution guidelines and to see our Contributor License Agreement.
Refer to NOTICE.md for additional information and legal notices.

🔗 Links

  • 💾 Download
    • Download the latest release directly.
  • 📚 Documentation
    • For installation, setup, and everything else.
  • 📦 npm
    • Use our npm package for enhanced functionality and TypeScript support.

✨ Features

  • Support for mysql-async and ghmattimysql syntax.
  • Promises / async query handling allowing for non-blocking and awaitable responses.
  • Improved performance and stability compared to other options.
  • Support for named and unnamed placeholders, improving performance and security.
  • Support for URI connection strings and semicolon separated values.
  • Improved parameter checking and error handling.

Lua query builder

Load the imports you need in your resource's fxmanifest.lua:

server_scripts {
    '@oxmysql/lib/MySQL.lua',
    '@oxmysql/lib/Builder.lua',
    'server.lua',
}

Builder provides SELECT, INSERT, and UPDATE queries and predicate operators. MySQL provides the existing raw SQL functions. The imports work independently and can be loaded in either order.

local users = Builder.table('users')
    :select({ 'id', 'name' })
    :where(Builder.op.eq('active', true))
    :limit(10)
    :get()

local insertId = Builder.table('users'):insert({ name = 'Avery', active = true })

local affectedRows = Builder.table('users')
    :where(Builder.op.eq('id', insertId))
    :update({ active = false })

local count = MySQL.scalar.await('SELECT COUNT(*) FROM users')

insert(rowOrRows, callback?) accepts a non-empty row map or a dense array of rows with identical column names. update(values, callback?) requires a where predicate; use :allowAll():update(values) to deliberately update every row. Without callbacks, both terminals await internally. Mutation values use the same scalar rules as predicates. Column map keys must be unqualified names. select() and limit() are unsupported on mutations; where() and allowAll() are unsupported on inserts.

Existing builder calls must change from MySQL.table / MySQL.op to Builder.table / Builder.op and load @oxmysql/lib/Builder.lua.

For coding agents, the oxmysql query builder skill covers imports, supported queries, execution behavior, and migration from the earlier MySQL builder namespace.

🧾 Logging

We have included a module for submitting error logs to Fivemanage, a cloud management service tailored for game servers. Additional logging options and support for other services will be available in the future.

Lua Language Server

  • Install Lua Language Server to ease development with annotations, type checking, diagnostics, and more.
  • See ox_types for our Lua type definitions.

Jelajahi proyek terkait

Memuat…