drizzle-sybase 2.0.1 → 3.0.0
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/README.md +72 -6
- package/dist/columns/index.d.ts +186 -36
- package/dist/columns/index.d.ts.map +1 -1
- package/dist/columns/index.js +113 -23
- package/dist/columns/index.js.map +1 -1
- package/dist/connection.d.ts +77 -157
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +244 -506
- package/dist/connection.js.map +1 -1
- package/dist/datetime.d.ts +15 -0
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +25 -0
- package/dist/datetime.js.map +1 -1
- package/dist/db.d.ts +36 -10
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +15 -25
- package/dist/db.js.map +1 -1
- package/dist/dialect.d.ts +24 -0
- package/dist/dialect.d.ts.map +1 -1
- package/dist/dialect.js +63 -9
- package/dist/dialect.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/introspect/codegen.d.ts +8 -1
- package/dist/introspect/codegen.d.ts.map +1 -1
- package/dist/introspect/codegen.js +117 -29
- package/dist/introspect/codegen.js.map +1 -1
- package/dist/introspect/fetch.d.ts +9 -2
- package/dist/introspect/fetch.d.ts.map +1 -1
- package/dist/introspect/fetch.js +37 -8
- package/dist/introspect/fetch.js.map +1 -1
- package/dist/introspect/index.d.ts +1 -0
- package/dist/introspect/index.d.ts.map +1 -1
- package/dist/introspect/index.js +8 -5
- package/dist/introspect/index.js.map +1 -1
- package/dist/introspect/type-map.d.ts +17 -8
- package/dist/introspect/type-map.d.ts.map +1 -1
- package/dist/introspect/type-map.js +28 -9
- package/dist/introspect/type-map.js.map +1 -1
- package/dist/native/index.d.ts +4 -1
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js.map +1 -1
- package/dist/native/sybase_native.darwin-arm64.node +0 -0
- package/dist/native/sybase_native.darwin-x64.node +0 -0
- package/dist/native/sybase_native.linux-arm64.node +0 -0
- package/dist/native/sybase_native.linux-x64.node +0 -0
- package/dist/native/sybase_native.win32-x64.node +0 -0
- package/dist/pool.d.ts +197 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +638 -0
- package/dist/pool.js.map +1 -0
- package/dist/query-builders/delete.d.ts +6 -4
- package/dist/query-builders/delete.d.ts.map +1 -1
- package/dist/query-builders/delete.js +4 -4
- package/dist/query-builders/delete.js.map +1 -1
- package/dist/query-builders/index.d.ts +1 -1
- package/dist/query-builders/index.d.ts.map +1 -1
- package/dist/query-builders/index.js.map +1 -1
- package/dist/query-builders/insert.d.ts +28 -4
- package/dist/query-builders/insert.d.ts.map +1 -1
- package/dist/query-builders/insert.js +8 -5
- package/dist/query-builders/insert.js.map +1 -1
- package/dist/query-builders/select-types.d.ts +132 -0
- package/dist/query-builders/select-types.d.ts.map +1 -0
- package/dist/query-builders/select-types.js +2 -0
- package/dist/query-builders/select-types.js.map +1 -0
- package/dist/query-builders/select.d.ts +54 -34
- package/dist/query-builders/select.d.ts.map +1 -1
- package/dist/query-builders/select.js +99 -92
- package/dist/query-builders/select.js.map +1 -1
- package/dist/query-builders/update.d.ts +7 -5
- package/dist/query-builders/update.d.ts.map +1 -1
- package/dist/query-builders/update.js +4 -4
- package/dist/query-builders/update.js.map +1 -1
- package/dist/session.d.ts +141 -14
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +456 -40
- package/dist/session.js.map +1 -1
- package/dist/sql-classify.d.ts +70 -0
- package/dist/sql-classify.d.ts.map +1 -0
- package/dist/sql-classify.js +189 -0
- package/dist/sql-classify.js.map +1 -0
- package/dist/table.d.ts +85 -3
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +8 -2
- package/dist/table.js.map +1 -1
- package/package.json +9 -8
- package/scripts/clean.ts +4 -3
- package/src/native/binding.c +463 -62
package/dist/columns/index.js
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Does NOT depend on drizzle-orm/mssql-core.
|
|
9
9
|
*/
|
|
10
|
+
import { aliasedColumn } from "drizzle-orm";
|
|
10
11
|
import { EXACT_NUMERIC_TYPES } from "../codecs.js";
|
|
12
|
+
/** drizzle's handle from an aliased column back to the column it aliases. */
|
|
13
|
+
export const OriginalColumn = Symbol.for("drizzle:OriginalColumn");
|
|
11
14
|
// We use the entityKind symbol to make our classes recognized by drizzle-orm's
|
|
12
15
|
// `is()` function without needing to extend the heavily-generic base classes.
|
|
13
16
|
const entityKind = Symbol.for("drizzle:entityKind");
|
|
@@ -19,7 +22,10 @@ const CODEC_KEYS = new Set(EXACT_NUMERIC_TYPES);
|
|
|
19
22
|
* codec re-reads the full type from the column when it matters.
|
|
20
23
|
*/
|
|
21
24
|
function codecKey(dataType) {
|
|
22
|
-
|
|
25
|
+
// Cut at the parenthesis rather than with /\s*\(.*$/, which backtracks
|
|
26
|
+
// quadratically on a long run of spaces.
|
|
27
|
+
const paren = dataType.indexOf("(");
|
|
28
|
+
const base = (paren === -1 ? dataType : dataType.slice(0, paren)).trimEnd().toLowerCase();
|
|
23
29
|
return CODEC_KEYS.has(base) ? base : undefined;
|
|
24
30
|
}
|
|
25
31
|
// ---------------------------------------------------------------------------
|
|
@@ -91,6 +97,18 @@ export class SybaseColumn {
|
|
|
91
97
|
// which checks `is(chunk, Column)` and reads chunk.name/chunk.table directly.
|
|
92
98
|
return { queryChunks: [this] };
|
|
93
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The column under an alias, as drizzle's `column.as()`: in SQL it renders as
|
|
102
|
+
* the alias alone (e.g. to order by a select alias); as a select field it
|
|
103
|
+
* selects this column.
|
|
104
|
+
*/
|
|
105
|
+
as(alias) {
|
|
106
|
+
return aliasedColumn(this, alias);
|
|
107
|
+
}
|
|
108
|
+
/** @internal What drizzle's alias proxy resolves back to. */
|
|
109
|
+
[OriginalColumn]() {
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
94
112
|
}
|
|
95
113
|
// Make SybaseColumn pass `is(col, Column)` by inserting a marker
|
|
96
114
|
// with entityKind = "Column" in the prototype chain.
|
|
@@ -132,27 +150,55 @@ export class SybaseColumnBuilder {
|
|
|
132
150
|
this._config.identity = true;
|
|
133
151
|
return this;
|
|
134
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Declare the default the database applies (the column's `DEFAULT`), as in
|
|
155
|
+
* drizzle: an insert may omit the column, and the driver then leaves it out
|
|
156
|
+
* of the statement so the server fills it. `value` is documentation only —
|
|
157
|
+
* it is never sent. For a default computed by the client, use
|
|
158
|
+
* {@link $defaultFn}.
|
|
159
|
+
*/
|
|
135
160
|
default(value) {
|
|
136
161
|
this._config.default = value;
|
|
137
162
|
this._config.hasDefault = true;
|
|
138
163
|
return this;
|
|
139
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* The database supplies a value when an insert omits the column (a `DEFAULT`
|
|
167
|
+
* constraint or a bound default), so inserts may leave it out. Like
|
|
168
|
+
* {@link default}, without stating the value — what the schema generator
|
|
169
|
+
* emits, since a catalog default is SQL text rather than a JS value.
|
|
170
|
+
*/
|
|
171
|
+
hasDatabaseDefault() {
|
|
172
|
+
this._config.hasDefault = true;
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
140
175
|
$defaultFn(fn) {
|
|
141
176
|
this._config.defaultFn = fn;
|
|
142
177
|
this._config.hasDefault = true;
|
|
143
178
|
return this;
|
|
144
179
|
}
|
|
180
|
+
/** Also applied on insert when the column is omitted, so inserts may leave it out. */
|
|
145
181
|
$onUpdateFn(fn) {
|
|
146
182
|
this._config.onUpdateFn = fn;
|
|
147
183
|
return this;
|
|
148
184
|
}
|
|
149
185
|
/**
|
|
150
|
-
* Set a custom mapToDriverValue function for this column.
|
|
186
|
+
* Set a custom mapToDriverValue function for this column. The values an
|
|
187
|
+
* insert or update accepts become what `fn` takes; reads are unaffected
|
|
188
|
+
* (there is no read-side hook — see `SybaseColumn#mapToDriverValue`).
|
|
151
189
|
*/
|
|
152
190
|
$mapToDriver(fn) {
|
|
153
191
|
this._config.mapToDriverValue = fn;
|
|
154
192
|
return this;
|
|
155
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Narrow the column's value type, e.g. to a union of string literals. Types
|
|
196
|
+
* only: the driver still returns what the SQL type decodes to, so `TData`
|
|
197
|
+
* must be a subtype of it.
|
|
198
|
+
*/
|
|
199
|
+
$type() {
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
156
202
|
/** @internal — called by sybaseTable to produce the final Column object */
|
|
157
203
|
build(table) {
|
|
158
204
|
return new SybaseColumn(table, this._config);
|
|
@@ -161,41 +207,85 @@ export class SybaseColumnBuilder {
|
|
|
161
207
|
// ---------------------------------------------------------------------------
|
|
162
208
|
// Column type factory functions
|
|
163
209
|
// ---------------------------------------------------------------------------
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
210
|
+
// The declared value types mirror how `binding.c` decodes each SQL type (and
|
|
211
|
+
// `datetime.ts` for the temporal ones); `type-map.ts` holds the same mapping
|
|
212
|
+
// for the code generator. A test checks all three agree against a live server.
|
|
213
|
+
const column = (name, sqlType) => new SybaseColumnBuilder(name, sqlType);
|
|
214
|
+
export const int = (name) => column(name, "int");
|
|
215
|
+
/** 64-bit: read as a `BigInt`; written from a `BigInt` or a digit string, never a lossy `number`. */
|
|
216
|
+
export const bigint = (name) => column(name, "bigint");
|
|
217
|
+
export const smallint = (name) => column(name, "smallint");
|
|
218
|
+
export const tinyint = (name) => column(name, "tinyint");
|
|
219
|
+
export const unsignedSmallint = (name) => column(name, "unsigned smallint");
|
|
220
|
+
/** Up to 4294967295: past an `int`, but exact in a `number`. */
|
|
221
|
+
export const unsignedInt = (name) => column(name, "unsigned int");
|
|
222
|
+
/** Up to 18446744073709551615: read as a `BigInt`; written from a `BigInt` or a digit string. */
|
|
223
|
+
export const unsignedBigint = (name) => column(name, "unsigned bigint");
|
|
168
224
|
/**
|
|
169
225
|
* A type whose width is a single length, e.g. `varchar(30)`.
|
|
170
226
|
*
|
|
171
227
|
* A length of 0 is treated as absent, so the type is emitted bare — ASE supplies
|
|
172
228
|
* its own default and a `varchar(0)` would be rejected.
|
|
173
229
|
*/
|
|
174
|
-
const sizedByLength = (type) => (name, opts) =>
|
|
175
|
-
/**
|
|
230
|
+
const sizedByLength = (type) => (name, opts) => column(name, opts?.length ? `${type}(${opts.length})` : type);
|
|
231
|
+
/**
|
|
232
|
+
* A fixed-point type whose width is a precision and an optional scale, e.g.
|
|
233
|
+
* `numeric(19,4)`. Read as a digit string; what it accepts on write depends on
|
|
234
|
+
* the width (see {@link DecimalWrite}), so the width is captured as literals.
|
|
235
|
+
*/
|
|
176
236
|
const sizedByPrecision = (type) => (name, opts) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
237
|
+
const sqlType = opts?.precision === undefined
|
|
238
|
+
? type
|
|
239
|
+
: opts.scale === undefined
|
|
240
|
+
? `${type}(${opts.precision})`
|
|
241
|
+
: `${type}(${opts.precision},${opts.scale})`;
|
|
242
|
+
return column(name, sqlType);
|
|
182
243
|
};
|
|
183
244
|
export const varchar = sizedByLength("varchar");
|
|
184
245
|
export const nvarchar = sizedByLength("nvarchar");
|
|
185
246
|
export const char = sizedByLength("char");
|
|
186
247
|
export const nchar = sizedByLength("nchar");
|
|
187
|
-
export const
|
|
188
|
-
export const
|
|
189
|
-
export const
|
|
190
|
-
|
|
248
|
+
export const univarchar = sizedByLength("univarchar");
|
|
249
|
+
export const unichar = sizedByLength("unichar");
|
|
250
|
+
export const text = (name) => column(name, "text");
|
|
251
|
+
/**
|
|
252
|
+
* ASE has no `ntext` type — use `text`, or `unitext` for Unicode. Kept so
|
|
253
|
+
* existing schemas compile; it behaves exactly like `text`.
|
|
254
|
+
*
|
|
255
|
+
* @deprecated ASE has no `ntext` type.
|
|
256
|
+
*/
|
|
257
|
+
export const ntext = (name) => column(name, "ntext");
|
|
258
|
+
/**
|
|
259
|
+
* Unicode text, read and written as UTF-16LE bytes. db-lib receives it as an
|
|
260
|
+
* image, so reads arrive undecoded; and a string literal is converted through
|
|
261
|
+
* the server charset, which mangles anything it cannot represent. Raw bytes
|
|
262
|
+
* round-trip exactly (checked against ASE 15.7):
|
|
263
|
+
* `Buffer.from(text, "utf16le")` to write, `buffer.toString("utf16le")` to read.
|
|
264
|
+
*/
|
|
265
|
+
export const unitext = (name) => column(name, "unitext");
|
|
266
|
+
export const datetime = (name) => column(name, "datetime");
|
|
267
|
+
export const smalldatetime = (name) => column(name, "smalldatetime");
|
|
268
|
+
/**
|
|
269
|
+
* A calendar date (`YYYY-MM-DD`). Read as text, not a `Date`: it is not an
|
|
270
|
+
* instant, and a `Date` would place it in some time zone.
|
|
271
|
+
*/
|
|
272
|
+
export const date = (name) => column(name, "date");
|
|
273
|
+
/** A time of day (`HH:MM:SS.mmm`), read as text for the same reason as {@link date}. */
|
|
274
|
+
export const time = (name) => column(name, "time");
|
|
275
|
+
/** Microsecond precision, finer than a `Date` holds: read and written as text. */
|
|
276
|
+
export const bigdatetime = (name) => column(name, "bigdatetime");
|
|
277
|
+
/** Microsecond precision, finer than a `Date` holds: read and written as text. */
|
|
278
|
+
export const bigtime = (name) => column(name, "bigtime");
|
|
191
279
|
export const numeric = sizedByPrecision("numeric");
|
|
192
280
|
export const decimal = sizedByPrecision("decimal");
|
|
193
|
-
export const float = (name) =>
|
|
194
|
-
export const real = (name) =>
|
|
195
|
-
|
|
196
|
-
export const
|
|
197
|
-
|
|
281
|
+
export const float = (name) => column(name, "float");
|
|
282
|
+
export const real = (name) => column(name, "real");
|
|
283
|
+
/** `money` is numeric(19,4): wider than a double, so it is written from digit strings only. */
|
|
284
|
+
export const money = (name) => column(name, "money");
|
|
285
|
+
/** `smallmoney` is numeric(10,4): a double holds it, so a `number` is accepted too. */
|
|
286
|
+
export const smallmoney = (name) => column(name, "smallmoney");
|
|
287
|
+
export const bit = (name) => column(name, "bit");
|
|
198
288
|
export const binary = sizedByLength("binary");
|
|
199
289
|
export const varbinary = sizedByLength("varbinary");
|
|
200
|
-
export const image = (name) =>
|
|
290
|
+
export const image = (name) => column(name, "image");
|
|
201
291
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAEpD,yEAAyE;AACzE,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAS,mBAAmB,CAAC,CAAC;AAE7E;;;;GAIG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAkB,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAgFlF,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAEpD,yEAAyE;AACzE,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAS,mBAAmB,CAAC,CAAC;AAE7E;;;;GAIG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,uEAAuE;IACvE,yCAAyC;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CA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,SAAS,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAS,IAAI,EAAE,OAAO,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAS,IAAI,EAAE,MAAM,CAAC,CAAC;AACnE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAiB,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7E,uFAAuF;AACvF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAA0B,IAAI,EAAE,YAAY,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAU,IAAI,EAAE,KAAK,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAS,QAAQ,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAS,WAAW,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAS,IAAI,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/connection.d.ts
CHANGED
|
@@ -7,8 +7,11 @@ export interface SybaseConnectionConfig {
|
|
|
7
7
|
/** Connection/query timeout in seconds. Default: 30 */
|
|
8
8
|
timeout?: number;
|
|
9
9
|
/**
|
|
10
|
-
* TDS network packet size in bytes. Larger values reduce round-trips
|
|
11
|
-
*
|
|
10
|
+
* TDS network packet size in bytes. Larger values reduce round-trips for big
|
|
11
|
+
* result sets. Default: 2048 — ASE's out-of-the-box `max network packet
|
|
12
|
+
* size`. A server refuses the login (with the same "Login failed" as a wrong
|
|
13
|
+
* password) when this exceeds its `max network packet size`, which a DBA can
|
|
14
|
+
* set as low as 512; set it to fit such a server.
|
|
12
15
|
*/
|
|
13
16
|
packetSize?: number;
|
|
14
17
|
/**
|
|
@@ -35,24 +38,12 @@ export interface SybaseConnectionConfig {
|
|
|
35
38
|
* Validated when the connection is created, not on first use.
|
|
36
39
|
*/
|
|
37
40
|
timeZone?: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/** Connection acquire timeout in ms. Default: 10000 (10s) */
|
|
45
|
-
acquireTimeoutMs?: number;
|
|
46
|
-
/** How often to run idle cleanup in ms. Default: 30000 (30s) */
|
|
47
|
-
cleanupIntervalMs?: number;
|
|
48
|
-
/** Enable health check ping before returning connection from pool. Default: false */
|
|
49
|
-
healthCheck?: boolean;
|
|
50
|
-
/** Max retries for transient connection failures. Default: 2 */
|
|
51
|
-
retries?: number;
|
|
52
|
-
/** Delay between retries in ms. Default: 500 */
|
|
53
|
-
retryDelayMs?: number;
|
|
54
|
-
/** Query logger callback. Called for every query executed through the pool. */
|
|
55
|
-
logger?: SybaseLogger;
|
|
41
|
+
/**
|
|
42
|
+
* @internal `false` skips the warning about a server clock outside
|
|
43
|
+
* {@link timeZone}, for connections that read no datetime values (schema
|
|
44
|
+
* introspection), where it would only be noise.
|
|
45
|
+
*/
|
|
46
|
+
warnOnTimeZoneMismatch?: boolean;
|
|
56
47
|
}
|
|
57
48
|
export interface QueryResult<T = Record<string, unknown>> {
|
|
58
49
|
rows: T[];
|
|
@@ -98,30 +89,44 @@ export interface SybaseLogger {
|
|
|
98
89
|
query(log: SybaseQueryLog): void;
|
|
99
90
|
}
|
|
100
91
|
/**
|
|
101
|
-
*
|
|
92
|
+
* Hand a log entry to the logger, isolating the caller from it: a throwing
|
|
93
|
+
* logger must not turn a successful query into a failure, nor skip releasing
|
|
94
|
+
* or rolling back the connection.
|
|
95
|
+
*
|
|
96
|
+
* @internal
|
|
102
97
|
*/
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
/** Total query errors encountered. */
|
|
111
|
-
totalQueryErrors: number;
|
|
112
|
-
/** Total acquire timeouts. */
|
|
113
|
-
totalAcquireTimeouts: number;
|
|
114
|
-
/** Average query duration in ms (rolling). */
|
|
115
|
-
avgQueryDurationMs: number;
|
|
116
|
-
/** Current pool size. */
|
|
117
|
-
currentSize: number;
|
|
118
|
-
/** Current active (in-use) connections. */
|
|
119
|
-
currentActive: number;
|
|
120
|
-
/** Current idle connections. */
|
|
121
|
-
currentIdle: number;
|
|
122
|
-
/** Current queue length. */
|
|
123
|
-
currentWaiting: number;
|
|
98
|
+
export declare const emitQueryLog: (logger: SybaseLogger | undefined, log: SybaseQueryLog) => void;
|
|
99
|
+
/** Options for a single query. */
|
|
100
|
+
export interface SybaseQueryOptions {
|
|
101
|
+
/** Cap on the rows returned; rows past it are discarded. */
|
|
102
|
+
maxRows?: number;
|
|
103
|
+
/** Hard timeout in ms (see {@link SybaseConnectionConfig.hardTimeoutMs}). */
|
|
104
|
+
hardTimeoutMs?: number;
|
|
124
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* A single integer server variable from a one-row result, or `undefined` if
|
|
108
|
+
* the result is not shaped that way. `Number(null)` and `Number("")` are 0, so
|
|
109
|
+
* those are rejected explicitly — a missing value must not read as one.
|
|
110
|
+
*
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
export declare const readServerInt: (rows: unknown[], key: string) => number | undefined;
|
|
114
|
+
/** @internal */
|
|
115
|
+
export declare const MAX_INT32 = 2147483647;
|
|
116
|
+
/**
|
|
117
|
+
* Reject a numeric option that is not an integer in range. These values end
|
|
118
|
+
* up in timers (which treat anything past 2^31-1 ms as 1 ms), in C ints, or in
|
|
119
|
+
* pool arithmetic where `NaN` makes every comparison false and the pool never
|
|
120
|
+
* opens a connection — each a silent malfunction, so a bad value fails here.
|
|
121
|
+
*/
|
|
122
|
+
/** @internal */
|
|
123
|
+
export declare const checkInteger: (name: string, value: number | undefined, min: number, max: number, message?: string) => void;
|
|
124
|
+
/** Validate the options a single connection uses. */
|
|
125
|
+
/** @internal */
|
|
126
|
+
export declare const validateConnectionConfig: (config: SybaseConnectionConfig) => void;
|
|
127
|
+
/** Validate the options of a single query. */
|
|
128
|
+
/** @internal */
|
|
129
|
+
export declare const validateQueryOptions: (options: SybaseQueryOptions | undefined) => void;
|
|
125
130
|
/**
|
|
126
131
|
* A single Sybase connection wrapping the native FreeTDS handle.
|
|
127
132
|
*
|
|
@@ -132,130 +137,45 @@ export declare class SybaseConnection {
|
|
|
132
137
|
private readonly config;
|
|
133
138
|
private handle;
|
|
134
139
|
private closed;
|
|
135
|
-
private inUse;
|
|
136
140
|
/** Promise queue to serialize queries on a single DBPROCESS (not thread-safe). */
|
|
137
141
|
private queryQueue;
|
|
138
142
|
constructor(config: SybaseConnectionConfig);
|
|
139
143
|
connect(): Promise<void>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
private executeQuery;
|
|
145
|
-
close(): void;
|
|
146
|
-
get isConnected(): boolean;
|
|
147
|
-
/** @internal */
|
|
148
|
-
get _inUse(): boolean;
|
|
149
|
-
/** @internal */
|
|
150
|
-
set _inUse(val: boolean);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Production-grade connection pool for Sybase ASE.
|
|
154
|
-
*
|
|
155
|
-
* Features:
|
|
156
|
-
* - max pool sizing with automatic scaling
|
|
157
|
-
* - Health checks (dead connection detection + optional ping)
|
|
158
|
-
* - Idle connection cleanup
|
|
159
|
-
* - Acquire timeout with fair queuing
|
|
160
|
-
* - Retry on transient connection failures
|
|
161
|
-
* - Graceful drain/shutdown
|
|
162
|
-
* - Observable metrics for monitoring
|
|
163
|
-
* - Query logging middleware
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```ts
|
|
167
|
-
* const pool = new SybasePool({
|
|
168
|
-
* host: "sybase-host",
|
|
169
|
-
* port: 5000,
|
|
170
|
-
* database: "mydb",
|
|
171
|
-
* username: "sa",
|
|
172
|
-
* password: "secret",
|
|
173
|
-
* max: 10,
|
|
174
|
-
* logger: { query(log) { console.log(`[${log.durationMs}ms] ${log.sql}`); } }
|
|
175
|
-
* });
|
|
176
|
-
*
|
|
177
|
-
* const result = await pool.query("SELECT 1 AS val");
|
|
178
|
-
* console.log(pool.metrics);
|
|
179
|
-
* await pool.drain();
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
export declare class SybasePool {
|
|
183
|
-
private pool;
|
|
184
|
-
private waitQueue;
|
|
185
|
-
private closed;
|
|
186
|
-
private draining;
|
|
187
|
-
private cleanupTimer;
|
|
188
|
-
private readonly cfg;
|
|
189
|
-
private _totalConnectionsCreated;
|
|
190
|
-
private _totalConnectionsDestroyed;
|
|
191
|
-
private _totalQueriesExecuted;
|
|
192
|
-
private _totalQueryErrors;
|
|
193
|
-
private _totalAcquireTimeouts;
|
|
194
|
-
private _queryDurationSum;
|
|
195
|
-
private _queryDurationCount;
|
|
196
|
-
private _activeCount;
|
|
197
|
-
/** Number of connections currently being created (prevents exceeding max). */
|
|
198
|
-
private _pendingCreates;
|
|
199
|
-
constructor(config: SybasePoolConfig);
|
|
200
|
-
/**
|
|
201
|
-
* Acquire a connection from the pool.
|
|
202
|
-
* - Validates existing connections (health check)
|
|
203
|
-
* - Creates new connections up to `max`
|
|
204
|
-
* - Queues if pool is full
|
|
205
|
-
*/
|
|
206
|
-
acquire(): Promise<SybaseConnection>;
|
|
207
|
-
/**
|
|
208
|
-
* Release a connection back to the pool.
|
|
209
|
-
*/
|
|
210
|
-
release(conn: SybaseConnection): void;
|
|
211
|
-
/**
|
|
212
|
-
* Execute a query using a pooled connection (auto acquire/release).
|
|
213
|
-
* Retries on transient connection failures.
|
|
214
|
-
*/
|
|
215
|
-
query<T = Record<string, unknown>>(sql: string, options?: {
|
|
216
|
-
maxRows?: number;
|
|
217
|
-
hardTimeoutMs?: number;
|
|
218
|
-
}): Promise<QueryResult<T>>;
|
|
144
|
+
private connecting;
|
|
145
|
+
private open;
|
|
146
|
+
/** Isolation level the session had when it was opened; what {@link resetSessionState} restores. */
|
|
147
|
+
private baseline;
|
|
219
148
|
/**
|
|
220
|
-
*
|
|
149
|
+
* Return the session to the state it was opened in: no open transaction,
|
|
150
|
+
* unchained, `ROWCOUNT 0`, the original isolation level and the configured
|
|
151
|
+
* database — so whatever a statement changed cannot reach the next user of a
|
|
152
|
+
* pooled connection.
|
|
221
153
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
154
|
+
* Resolves to whether a transaction was left open or chained mode was on
|
|
155
|
+
* (both are undone). Rejects if the state cannot be established; the caller
|
|
156
|
+
* must then discard the connection.
|
|
224
157
|
*
|
|
225
|
-
* @
|
|
158
|
+
* @internal
|
|
226
159
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
160
|
+
resetSessionState(): Promise<{
|
|
161
|
+
leftOpen: boolean;
|
|
162
|
+
}>;
|
|
230
163
|
/**
|
|
231
|
-
*
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
get waiting(): number;
|
|
242
|
-
/** Whether the pool is currently draining. */
|
|
243
|
-
get isDraining(): boolean;
|
|
244
|
-
/** Whether the pool is closed. */
|
|
245
|
-
get isClosed(): boolean;
|
|
246
|
-
/** @internal Get the configured logger (if any). */
|
|
247
|
-
get logger(): SybaseLogger | undefined;
|
|
248
|
-
/**
|
|
249
|
-
* Get a snapshot of pool metrics for monitoring/observability.
|
|
250
|
-
*/
|
|
251
|
-
get metrics(): SybasePoolMetrics;
|
|
252
|
-
private createConnection;
|
|
253
|
-
private removeFromPool;
|
|
254
|
-
private serveWaiter;
|
|
255
|
-
/**
|
|
256
|
-
* Remove idle connections that have exceeded the idle timeout.
|
|
164
|
+
* Drop every temporary table this session has created, so a pooled
|
|
165
|
+
* connection does not hand them to its next user.
|
|
166
|
+
*
|
|
167
|
+
* ASE stores `#t` in the session's tempdb (one of several, see
|
|
168
|
+
* `@@tempdbid`) as `#t` plus a 17-character session suffix. A row is this
|
|
169
|
+
* session's own exactly when `object_id` of its base name — resolved per
|
|
170
|
+
* session — is that row's id. Temporary table names cannot be quoted
|
|
171
|
+
* (Msg 11717), so the base names are used as they are.
|
|
172
|
+
*
|
|
173
|
+
* @internal
|
|
257
174
|
*/
|
|
258
|
-
|
|
259
|
-
|
|
175
|
+
dropTempTables(): Promise<void>;
|
|
176
|
+
query<T = Record<string, unknown>>(sql: string, options?: SybaseQueryOptions): Promise<QueryResult<T>>;
|
|
177
|
+
private executeQuery;
|
|
178
|
+
close(): void;
|
|
179
|
+
get isConnected(): boolean;
|
|
260
180
|
}
|
|
261
181
|
//# sourceMappingURL=connection.d.ts.map
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAA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