[Release] vSql - MySQL Async Library

vSql

FiveM resource for connecting to MySQL database.

Features

Download

Binaries: Releases · warxander/vSql · GitHub
Source code: GitHub - warxander/vSql: FiveM MySQL Async library

How to Install

  • Download and put into resources/ folder
  • Add ensure vSql to server.cfg
  • Add set mysql_connection_string "server=localhost;database=db;userid=user;password=pwd" to server.cfg
  • Add server_script "@vSql/vSql.lua" to fxmanifest.lua

API

vSql.Async.execute(query, parameters, callback)
vSql.Async.transaction(queries, parameters, callback)

vSql.Async.fetchScalar(query, parameters, callback)
vSql.Async.fetchAll(query, parameters, callback)

Note

This resource is mainly for:

  • People, who are still using old C# MySQL Async library or not happy with JS-version.
    You should get better performance and internal bug fixes.
  • Creating new resource with database usage

Benchmark Results

vSql 1.5.1 MySQL.Async 2.1.2
.transaction(ms) [ 56, 54, 55 ] [ 621, 617, 617 ]
.execute (ms) [ 56, 54, 55 ] [ 263, 257, 259 ]
.fetchScalar (ms) [ 53, 53, 54 ] [ 259, 262, 257 ]
.fetchAll (ms) [ 54, 56, 55 ] [ 264, 261, 259 ]

Benchmark: sql-test.rar (910 Bytes)

13 Likes

is it possible to see the real source code instead of the already-compiled dlls in your github?

edit: found the cs file my bad :slight_smile:still very confused repository

Very nice indeed!

You’re goddamn right.

I made a proper GitHub release without source code and other stuff.
Enjoy!

1 Like

Wondering what is the performance on this vs mysql-async js lib?

Awesome, @Warxander :slight_smile:
Noice release, this is perfect

vSql 1.1

  • Improved performance
  • Fixed passing query parameters as nil

Binaries: https://github.com/warxander/vSql/releases/tag/v1.1

Is there really any performance improvement using over other async’s? Some proof please

Nice job, would love to see performance vs mysql-async

Currently there are no proofs except using MySQL Connector 0.60 instead of 0.38, but I will add a real comparison later.

This will be great to see as in the near future I’m going to be converting my server from using vrp_mysql meant for vrp 0.5 which is complete garbage over to mysql-async, but if this has better performance than mysql-async, then this would be the better route for me to go.

Hello, so this replaced which the mysql-async or just async resource?

image

This isn’t just a simple replacement, do not expect a plug and play result.

strart async first.

Is this better than currently mysql-async?

It’s better to wait for next release and performance comparison results.

more speed lass cpu

vSql 1.2

  • Fixed transactions
  • Minor code refactoring

Binaries: https://github.com/warxander/vSql/releases/tag/v1.2

I could use with mysql async to traspase little by little every script?

To migrate from mysql-async you should:

  • Make sure you’re not using MySQL.Sync.* methods
  • Replace mysql-async resource with this one
  • Replace MySQL.Async with vSql.Async across all your codebase

Alright, here is my benchmark results.
I tested vSql 1.2 and MySQL.Async (C#) 2.1.2, as MySQL.Async 3.2.0 (JS) doesn’t support transactions.

vSql 1.2 MySQL.Async 2.1.2
.transaction (ms) [ 665, 656, 723 ] [ 613, 583, 580 ]
.execute (ms) [ 62, 62, 62 ] [ 159, 159, 161]
.fetchScalar (ms) [ 55, 57, 54 ] [ 316, 317, 312 ]
.fetchAll (ms) [ 60, 59, 59 ] [ 216, 220, 220 ]

Benchmark: sql-test.rar (961 Bytes)