open.mp forum
[Plugin] mysql_samp - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Plugins (https://forum.open.mp/forumdisplay.php?fid=32)
---- Thread: [Plugin] mysql_samp (/showthread.php?tid=3822)



mysql_samp - NullSablex - 2026-03-10

mysql_samp - Um plugin MySQL escrito em Rust

Criei esse plugin porque o R41-4 parou de funcionar no meu servidor.

O Problema Real

Em alguns ambientes Linux modernos (Debian 13, AlmaLinux), o socket do MySQL mudou de local. O socket não está mais em
Code:
/tmp/mysql.sock
. Quando tentava conectar com localhost, levava esse erro:

Code:
Conexão falhou — Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

O R41-4 simplesmente não consegue encontrar o socket. E pior: tem um bug chato com SSL que ninguém resolveu.

O Bug de SSL

Mesmo que você não esteja usando SSL, o plugin sempre reclama. Coloca a opção como desativado? Continua exigindo. É como se o plugin ignorasse completamente as opções de SSL que você passa.

Basicamente, com essas limitações, o R41-4 virou inútil pra mim.

Por Que Rust

Resolvi fazer do zero porque:
- Encontra socket em qualquer lugar (suporta caminhos customizados)
- Sem libmysqlclient bagunçando tudo
- SSL funciona como deveria (você ativa, ativa; desativa, desativa)
- Código novo, sem bugs antigos carregados

Funciona?

Sim. Testei nos ambientes problemáticos e continua funcionando. Sem aquele erro de socket. Sem aquela brincadeira de SSL.

Links

GitHub: https://github.com/NullSablex/mysql_samp
Releases: https://github.com/NullSablex/mysql_samp/releases

Se alguém tá com o mesmo problema, talvez ajude.



Update: mysql_samp - NullSablex - 2026-05-18

MYSQL_SAMP v1.1.0

Hoje, 18/05/2026, o plugin foi oficialmente atualizado para a versão 1.1.0.

Esta atualização traz melhorias significativas de arquitetura, estabilidade, compatibilidade expandida e integração completa com o novo rust-samp v3.0.0.

Apesar das mudanças internas profundas, a API Pawn permanece compatível — nenhuma native foi removida ou renomeada.

DESTAQUES

BINÁRIO UNIVERSAL

O mesmo `.so` / `.dll` agora funciona tanto no SA-MP quanto no Open Multiplayer.

COMPATIBILIDADE COM OPEN MULTIPLAYER

* Componente nativo (`components`)
* Modo legado (`legacy_plugins`)

FIM DA WORKAROUND COM SETTIMER

Callbacks threaded (`mysql_query`, `mysql_pquery`) agora são despachados automaticamente através do novo sistema unificado do rust-samp v3.

MYSQL_FORMAT MAIS SEGURO

* Truncamento correto em UTF-8
* Preserva conteúdo válido
* Warning no log
* Sem abortar native em overflow

VALIDAÇÃO MAIS RÍGIDA

`mysql_options_set_int` agora rejeita:

* Portas negativas
* Portas maiores que `65535`
* Timeouts negativos

MELHORIAS INTERNAS

* Refatoração de código
* Remoção de casts inseguros
* Helpers reutilizáveis para ORM
* Melhor mapeamento de logs
* Build migrado para `i686-pc-windows-msvc`
* Testes expandidos (`93 → 113`)
* CI modernizada

ARQUIVOS

mysql_samp.so -> Linux i686

mysql_samp.dll -> Windows i686

mysql_samp.inc -> Include único para SA-MP e Open Multiplayer

OBSERVAÇÃO IMPORTANTE

As opções:

MYSQL_OPT_SSL
MYSQL_OPT_SSL_CA

já são aceitas pelas funções `mysql_options_set_*`, porém ainda não estão conectadas internamente ao driver MySQL.

Atualmente as conexões continuam sendo plaintext.

LINKS

PLUGIN

GitHub:
https://github.com/NullSablex/mysql_samp

Releases:
https://github.com/NullSablex/mysql_samp/releases

RUST SDK

GitHub:
https://github.com/NullSablex/rust-samp

Releases:
https://github.com/NullSablex/rust-samp/releases

MYSQL_SAMP v1.1.0 (EN-US)

Today, 05/18/2026, the plugin has officially been updated to version 1.1.0.

This update brings major improvements in architecture, stability, expanded compatibility and full integration with the new rust-samp v3.0.0.

Despite the deep internal changes, the Pawn API remains fully compatible — no native has been removed or renamed.

HIGHLIGHTS

UNIVERSAL BINARY

The same `.so` / `.dll` now works on both SA-MP and Open Multiplayer.

OPEN MULTIPLAYER SUPPORT

* Native component mode (`components`)
* Legacy mode (`legacy_plugins`)

NO MORE SETTIMER WORKAROUND

Threaded callbacks (`mysql_query`, `mysql_pquery`) are now automatically dispatched through rust-samp v3's unified ticking system.

SAFER MYSQL_FORMAT

* Proper UTF-8 truncation
* Preserves valid content
* Logs warnings
* No more native aborts on overflow

STRICTER VALIDATION

`mysql_options_set_int` now properly rejects:

* Negative ports
* Ports larger than `65535`
* Negative timeouts

INTERNAL IMPROVEMENTS

* Code refactoring
* Unsafe casts removed
* Reusable ORM helpers
* Better log mapping
* Build migrated to `i686-pc-windows-msvc`
* Expanded tests (`93 → 113`)
* Hardened CI

ARTIFACTS

mysql_samp.so -> Linux i686

mysql_samp.dll -> Windows i686

mysql_samp.inc -> Shared include for SA-MP and Open Multiplayer

IMPORTANT NOTE

The options:

MYSQL_OPT_SSL
MYSQL_OPT_SSL_CA

are already accepted by `mysql_options_set_*`, but are not yet wired internally into the MySQL driver.

Connections are currently plaintext.

LINKS

PLUGIN

GitHub:
https://github.com/NullSablex/mysql_samp

Releases:
https://github.com/NullSablex/mysql_samp/releases

RUST SDK

GitHub:
https://github.com/NullSablex/rust-samp

Releases:
https://github.com/NullSablex/rust-samp/releases