Skip to content
المشاريع

حول

MySQL resource for FXServer.

البيانات والتحليلات

كيف تُقاس هذه الأرقام

ما يمكنك فعله

  • 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.

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
؜-١
خلال 15 يومًا
٠
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

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.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…