Member Junction
    Preparing search index...

    SQL Server implementation of CodeGenConnection. Wraps an mssql.ConnectionPool and adapts it to the generic interface.

    import sql from 'mssql';
    const pool = await sql.connect(config);
    const conn = new SQLServerCodeGenConnection(pool);

    // Simple query
    const result = await conn.query("SELECT ID, Name FROM Entities");

    // Parameterized query
    const result2 = await conn.queryWithParams(
    "SELECT ID FROM Entities WHERE Name = @Name",
    { Name: 'Users' }
    );

    Implements

    Index

    Constructors

    Accessors

    Methods

    • Executes a SQL query with named parameters. Parameters are passed as key-value pairs and the implementation is responsible for binding them safely (e.g.,

      Parameters

      • sqlText: string

        The SQL statement with parameter placeholders.

      • params: Record<string, unknown>

        Named parameters as key-value pairs.

      Returns Promise<CodeGenQueryResult>

      The query result with a recordset array.

      for SQL Server, $1/$2 for PostgreSQL).

      For SQL Server, the parameter names in the SQL should use @-prefix notation matching the keys in the params object. For PostgreSQL, the implementation translates @-prefixed names to $N notation.