@mikro-orm/sql 7.2.13 → 7.2.14-dev.1

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.
@@ -1,6 +1,7 @@
1
1
  import { NativeQueryBuilder } from '../../query/NativeQueryBuilder.js';
2
2
  /** @internal */
3
3
  export declare class MySqlNativeQueryBuilder extends NativeQueryBuilder {
4
+ protected readonly noLimit = "18446744073709551615";
4
5
  protected compileInsert(): void;
5
6
  protected addLockClause(): void;
6
7
  protected addOnConflictClause(): void;
@@ -2,6 +2,7 @@ import { isRaw, LockMode, Utils } from '@mikro-orm/core';
2
2
  import { NativeQueryBuilder } from '../../query/NativeQueryBuilder.js';
3
3
  /** @internal */
4
4
  export class MySqlNativeQueryBuilder extends NativeQueryBuilder {
5
+ noLimit = '18446744073709551615';
5
6
  compileInsert() {
6
7
  if (this.options.insertSubQuery) {
7
8
  super.compileInsert();
@@ -1,6 +1,7 @@
1
1
  import { NativeQueryBuilder } from '../../query/NativeQueryBuilder.js';
2
2
  /** @internal */
3
3
  export declare class SqliteNativeQueryBuilder extends NativeQueryBuilder {
4
+ protected readonly noLimit = "-1";
4
5
  protected compileTruncate(): void;
5
6
  protected addLockClause(): void;
6
7
  }
@@ -1,6 +1,7 @@
1
1
  import { NativeQueryBuilder } from '../../query/NativeQueryBuilder.js';
2
2
  /** @internal */
3
3
  export class SqliteNativeQueryBuilder extends NativeQueryBuilder {
4
+ noLimit = '-1';
4
5
  compileTruncate() {
5
6
  const sql = `delete from ${this.getTableName()}`;
6
7
  this.parts.push(sql);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.2.13",
3
+ "version": "7.2.14-dev.1",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.2.13"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.13"
56
+ "@mikro-orm/core": "7.2.14-dev.1"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -80,6 +80,8 @@ export declare class NativeQueryBuilder implements Subquery {
80
80
  protected parts: string[];
81
81
  protected params: unknown[];
82
82
  protected options: Options;
83
+ /** Literal emitted as `limit` for offset-only queries, for dialects that reject `offset` without `limit`. */
84
+ protected readonly noLimit?: string;
83
85
  constructor(platform: AbstractSqlPlatform);
84
86
  select(fields: string | RawQueryFragment | (string | RawQueryFragment)[]): this;
85
87
  count(fields?: string | RawQueryFragment | (string | RawQueryFragment)[], distinct?: boolean): this;
@@ -7,6 +7,8 @@ export class NativeQueryBuilder {
7
7
  parts = [];
8
8
  params = [];
9
9
  options = {};
10
+ /** Literal emitted as `limit` for offset-only queries, for dialects that reject `offset` without `limit`. */
11
+ noLimit;
10
12
  /** the table name or alias usable as a column qualifier (without the alias definition or index hint) */
11
13
  #tableQualifier;
12
14
  constructor(platform) {
@@ -348,6 +350,9 @@ export class NativeQueryBuilder {
348
350
  this.parts.push(`limit ?`);
349
351
  this.params.push(this.options.limit);
350
352
  }
353
+ else if (this.options.offset != null && this.noLimit) {
354
+ this.parts.push(`limit ${this.noLimit}`);
355
+ }
351
356
  if (this.options.offset != null) {
352
357
  this.parts.push(`offset ?`);
353
358
  this.params.push(this.options.offset);