meadow 2.0.46 → 2.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -34,6 +34,11 @@ var MeadowProvider = function ()
|
|
|
34
34
|
// Track which named params we've already mapped to a positional index
|
|
35
35
|
var tmpParamMap = {};
|
|
36
36
|
|
|
37
|
+
// Postgres booleans are stored as SMALLINT (0/1) for cross-engine SQL consistency, so coerce a
|
|
38
|
+
// JS boolean value to 1/0 before binding (mirrors the SQLite provider). Without this, node-pg
|
|
39
|
+
// binds true/false and the SMALLINT column rejects it.
|
|
40
|
+
var coerceBoolean = function (pV) { return (typeof pV === 'boolean') ? (pV ? 1 : 0) : pV; };
|
|
41
|
+
|
|
37
42
|
// Match :paramName patterns (word characters after a colon)
|
|
38
43
|
// but not inside quoted strings and not ::type casts
|
|
39
44
|
var tmpText = pQueryBody.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, function (pMatch, pParamName)
|
|
@@ -64,14 +69,14 @@ var MeadowProvider = function ()
|
|
|
64
69
|
{
|
|
65
70
|
tmpParamIndex++;
|
|
66
71
|
}
|
|
67
|
-
tmpValues.push(tmpValue[i]);
|
|
72
|
+
tmpValues.push(coerceBoolean(tmpValue[i]));
|
|
68
73
|
tmpPlaceholders.push('$' + tmpParamIndex);
|
|
69
74
|
}
|
|
70
75
|
return tmpPlaceholders.join(', ');
|
|
71
76
|
}
|
|
72
77
|
else
|
|
73
78
|
{
|
|
74
|
-
tmpValues.push(tmpValue);
|
|
79
|
+
tmpValues.push(coerceBoolean(tmpValue));
|
|
75
80
|
return '$' + tmpParamIndex;
|
|
76
81
|
}
|
|
77
82
|
});
|