open.mp forum
[Plugin] mysql_samp for SA-MP and open.mp - 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 for SA-MP and open.mp (/showthread.php?tid=3822)



mysql_samp for SA-MP and open.mp - 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 for SA-MP and open.mp - 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


RE: mysql_samp for SA-MP and open.mp - NullSablex - 2026-08-05

🗄️ mysql_samp v1.2.0

Plugin MySQL universal para SA-MP e open.mp
Universal MySQL plugin for SA-MP and open.mp


github.com/NullSablex/mysql_samp

Quote:🇧🇷 A versão 1.2.0 chegou! 🎉 Esta é a maior atualização do mysql_samp até agora, trazendo prepared statements, transações, hashing de senhas com Argon2id, suporte completo a TLS, diversas melhorias de desempenho e importantes correções de segurança — tudo funcionando tanto no SA-MP quanto no open.mp.

🇬🇧 Version 1.2.0 is here! 🎉 This is the biggest mysql_samp release so far, bringing prepared statements, transactions, Argon2id password hashing, full TLS support, performance improvements and major security fixes — all while remaining fully compatible with both SA-MP and open.mp.

✨ O que tem de novo / What's new

🛡️ Segurança reforçada
🇧🇷 O suporte a TLS foi corrigido e agora realmente criptografa as conexões com MySQL e MariaDB. Também foi corrigida uma vulnerabilidade de SQL Injection quando o servidor utilizava NO_BACKSLASH_ESCAPES, além de diversas melhorias internas relacionadas ao gerenciamento de statements, ORM e recursos.
🇬🇧 TLS support now properly encrypts MySQL and MariaDB connections. A SQL Injection issue under NO_BACKSLASH_ESCAPES was fixed, alongside several improvements to statement handling, the ORM and resource management.

🧩 Prepared Statements
🇧🇷 Agora é possível criar, reutilizar, executar e destruir prepared statements de forma nativa. Os parâmetros passam a ser enviados utilizando o protocolo binário do MySQL, aumentando a segurança e eliminando a necessidade de escape manual.
🇬🇧 Native prepared statement support has been added. Parameters are now sent through MySQL's binary protocol, improving security and removing the need for manual escaping.

🔄 Transações
🇧🇷 Novo suporte a transações para executar múltiplas consultas de forma atômica, com commit e rollback conforme necessário.
🇬🇧 New transaction support allows multiple queries to execute atomically with proper commit and rollback handling.

🔐 Hash de senhas com Argon2id
🇧🇷 Foram adicionadas funções assíncronas para geração e verificação de hashes utilizando Argon2id, permitindo autenticação moderna sem bloquear o servidor.
🇬🇧 New asynchronous Argon2id password hashing and verification functions provide modern authentication without blocking the server.

📡 TLS e autenticação avançada
🇧🇷 Agora também é possível utilizar certificados de cliente, chaves privadas e validação de certificados para conexões seguras.
🇬🇧 Client certificates, private keys and certificate verification are now supported for secure connections.

📄 Configuração e consultas por arquivo
🇧🇷 Novas funções permitem carregar conexões através de um arquivo mysql.ini e executar scripts SQL diretamente de arquivos.
🇬🇧 New natives allow loading connections from a mysql.ini file and executing SQL scripts directly from files.

📚 Múltiplos Result Sets
🇧🇷 Procedures e scripts SQL agora podem retornar múltiplos conjuntos de resultados acessíveis pela API de cache.
🇬🇧 Stored procedures and SQL scripts can now return multiple result sets accessible through the cache API.

📝 Logging aprimorado
🇧🇷 Rotação automática de logs, compressão em GZip, configuração por variáveis de ambiente e integração com o sistema de logging do rust-samp.
🇬🇧 Automatic log rotation, GZip compression, environment-variable configuration and integration with the rust-samp logging system.

📦 Exemplos e documentação
🇧🇷 O projeto recebeu diversos exemplos cobrindo prepared statements, transações, TLS, hashing de senhas e outros recursos, além de melhorias gerais na documentação.
🇬🇧 The project now includes several examples covering prepared statements, transactions, TLS, password hashing and other features, alongside documentation improvements.

🔄 Compatibilidade preservada
🇧🇷 Nenhuma API existente em Pawn foi removida ou renomeada, tornando a atualização para a versão 1.2.0 simples e direta.
🇬🇧 No existing Pawn API has been removed or renamed, making the upgrade to version 1.2.0 straightforward.

📋 Changelog completo / Full changelog
CHANGELOG.md

🚀 Muito mais do que novas funções / More than new features

Quote:🇧🇷 Além dos novos recursos, esta release representa uma grande evolução do projeto. Foram dezenas de correções, melhorias internas, reforços de segurança, documentação expandida e novos exemplos para facilitar o desenvolvimento de projetos modernos com MySQL.

🇬🇧 Beyond the new features, this release represents a major evolution of the project. It includes dozens of fixes, internal improvements, stronger security, expanded documentation and new examples to make developing modern MySQL-powered projects easier.

🇧🇷 Issues, PRs e feedback são sempre muito bem-vindos!
🇬🇧 Issues, PRs and feedback are always welcome!


⭐ github.com/NullSablex/mysql_samp