@anfenn/dync 1.0.20 → 1.0.22

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/dist/index.cjs CHANGED
@@ -2388,7 +2388,7 @@ var buildCondition = (condition) => {
2388
2388
  switch (condition.type) {
2389
2389
  case "equals": {
2390
2390
  if (condition.caseInsensitive) {
2391
- return { clause: `LOWER(${col}) = LOWER(?)`, parameters: [condition.value] };
2391
+ return { clause: `${col} = ? COLLATE NOCASE`, parameters: [condition.value] };
2392
2392
  }
2393
2393
  return { clause: `${col} = ?`, parameters: [condition.value] };
2394
2394
  }
@@ -2410,7 +2410,7 @@ var buildCondition = (condition) => {
2410
2410
  const placeholders = condition.values.map(() => "?").join(", ");
2411
2411
  if (condition.caseInsensitive) {
2412
2412
  return {
2413
- clause: `LOWER(${col}) IN (${condition.values.map(() => "LOWER(?)").join(", ")})`,
2413
+ clause: `${col} COLLATE NOCASE IN (${placeholders})`,
2414
2414
  parameters: condition.values
2415
2415
  };
2416
2416
  }
@@ -2425,9 +2425,10 @@ var buildCondition = (condition) => {
2425
2425
  }
2426
2426
  case "like": {
2427
2427
  if (condition.caseInsensitive) {
2428
- return { clause: `LOWER(${col}) LIKE LOWER(?)`, parameters: [condition.pattern] };
2428
+ return { clause: `${col} LIKE ?`, parameters: [condition.pattern] };
2429
2429
  }
2430
- return { clause: `${col} LIKE ?`, parameters: [condition.pattern] };
2430
+ const globPattern = condition.pattern.replace(/%/g, "*").replace(/_/g, "?");
2431
+ return { clause: `${col} GLOB ?`, parameters: [globPattern] };
2431
2432
  }
2432
2433
  }
2433
2434
  };