@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/{chunk-I2KQD4DD.js → chunk-YSKDP34Q.js} +6 -5
- package/dist/chunk-YSKDP34Q.js.map +1 -0
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
- package/src/storage/sqlite/helpers.ts +8 -4
- package/dist/chunk-I2KQD4DD.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/react/index.js
CHANGED
package/package.json
CHANGED
|
@@ -76,7 +76,8 @@ const buildCondition = (condition: SQLiteCondition): BuiltCondition => {
|
|
|
76
76
|
switch (condition.type) {
|
|
77
77
|
case 'equals': {
|
|
78
78
|
if (condition.caseInsensitive) {
|
|
79
|
-
|
|
79
|
+
// COLLATE NOCASE is more efficient than LOWER() as it can use indexes
|
|
80
|
+
return { clause: `${col} = ? COLLATE NOCASE`, parameters: [condition.value] };
|
|
80
81
|
}
|
|
81
82
|
return { clause: `${col} = ?`, parameters: [condition.value] };
|
|
82
83
|
}
|
|
@@ -102,7 +103,7 @@ const buildCondition = (condition: SQLiteCondition): BuiltCondition => {
|
|
|
102
103
|
const placeholders = condition.values.map(() => '?').join(', ');
|
|
103
104
|
if (condition.caseInsensitive) {
|
|
104
105
|
return {
|
|
105
|
-
clause:
|
|
106
|
+
clause: `${col} COLLATE NOCASE IN (${placeholders})`,
|
|
106
107
|
parameters: condition.values,
|
|
107
108
|
};
|
|
108
109
|
}
|
|
@@ -120,9 +121,12 @@ const buildCondition = (condition: SQLiteCondition): BuiltCondition => {
|
|
|
120
121
|
|
|
121
122
|
case 'like': {
|
|
122
123
|
if (condition.caseInsensitive) {
|
|
123
|
-
|
|
124
|
+
// LIKE is case-insensitive by default for ASCII in SQLite
|
|
125
|
+
return { clause: `${col} LIKE ?`, parameters: [condition.pattern] };
|
|
124
126
|
}
|
|
125
|
-
|
|
127
|
+
// GLOB is case-sensitive - convert LIKE wildcards (% → *, _ → ?)
|
|
128
|
+
const globPattern = condition.pattern.replace(/%/g, '*').replace(/_/g, '?');
|
|
129
|
+
return { clause: `${col} GLOB ?`, parameters: [globPattern] };
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
};
|