Edge-sql is an ADO.NET-based SQL compiler for Edge.js, enabling Node.js applications to access MS SQL, MySQL, and PostgreSQL databases via C#/CLR. As of v1.0.6, it supports .NET 4.6.2 (except PostgreSQL) and .NET Core/netstandard2.0, with optional environment variable or runtime connection strings. It automatically interprets SQL statement types (SELECT as data reader, UPDATE as non-query) and returns multiple result sets. Unlike pure JavaScript drivers, it bridges Node.js and .NET for scenarios where ADO.NET is preferred.
npm install edge-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to query MS SQL via Edge.js with edge-sql, using an inline SQL statement and a callback.
Add nonQuery: true to options if you need to run a select statement as a non-query (e.g., function call).
Use the fork: npm install edge-sql (which installs agracio's version).
Ensure your Edge.js is running on .NET Core to use PostgreSQL database option.
Set the environment variable before calling edge.func for the first time, or pass connectionString as an option.
Wrap geometry columns with ST_AsText in SELECT and use ST_GeomFromText in INSERT/UPDATE.
Make sure edge-js and edge-sql are both installed: npm install edge-js edge-sql. The compiler is registered by edge-sql when required? Actually, edge-js picks it up from node_modules; if not, try: require('edge-sql');Set EDGE_SQL_CONNECTION_STRING environment variable or pass { connectionString: '...' } to edge.func.Ensure the appropriate .NET data provider is installed (e.g., System.Data.SqlClient for MS SQL, Npgsql for PostgreSQL). For PostgreSQL, use .NET Core.
Ensure parameters object keys match the parameter names in SQL (case-insensitive for MS SQL).