Disponible
amalgame-mssql
MS SQL Server via ODBC et le pilote Microsoft.
Vue d'ensemble
Binding à MS SQL Server. Compatible SQL Server 2017+ et Azure SQL. Lien dynamique à unixODBC et au pilote ODBC officiel de Microsoft (ODBC Driver 18 ou 17), qui gère le protocole TDS.
Caractéristiques
- ✓Cible : SQL Server 2017+ et Azure SQL Database
- ✓Pilote ODBC Microsoft 18 (ou 17), choisi dans la chaîne de connexion
- ✓Paramètres
?avecExecBind/QueryBindAll, transactionsBegin/Commit/Rollback - ✓TLS réglé dans la chaîne de connexion (
Encrypt=yes), géré par le pilote - ✓Pattern dynamic-link — pas de fork vendored
Prévu
- ◐Réutilisation des requêtes préparées
- ◐Accès typés aux colonnes : aujourd'hui, chaque cellule revient en texte
- ◐Insertion en masse (
bcp) et requêtes asynchrones - ◐Paramètres table (TVP)
Exemple
Exemple minimal d'utilisation — recopiable tel quel après l'install.
import Amalgame.Database.MSSQL
public class Program {
public static void Main() {
let db = MSSQL.Open("Driver={ODBC Driver 18 for SQL Server};"
+ "Server=tcp:db.example.com,1433;Database=app;UID=app;PWD=secret;Encrypt=yes")
if (!MSSQL.IsOpen(db)) {
Console.WriteLine("connect failed: " + MSSQL.LastError(db))
return
}
let params = new List<string>()
params.Add("42")
let rows = MSSQL.QueryBindAll(db, "SELECT id, total FROM orders WHERE customer_id = ?", params)
for row in rows {
Console.WriteLine(row.Get(0) + " : " + row.Get(1))
}
MSSQL.Close(db)
}
}
En bref
- Licence : Apache-2.0
- Installation :
amc package add mssql - Code source : amalgame-lang/amalgame-database-mssql
- Index officiel : amalgame-lang/packages-index