dresende/node-sql-query

Null parameter in function returns error -> Cannot read property 'type' of null

Closed this issue · 1 comments

Using the following as part of Select
.fun('dbo.fnBalance', [80, null, null], 'balance')
returns this error Cannot read property 'type' of null

To prevent this, add the following lines just before if (typeof el.type == "function") { at line 261 in lib/Select.js

if (!el) {
    return Dialect.escapeVal(el);
}

This builds the correct sql which is
DBO.FNBALANCE(80, NULL, NULL)

I don't bother forking for something small as this, so hopefully you're willing to get this in?

dxg commented

Thanks. It's in master.