Skip to content

Commit 9a4bae2

Browse files
committed
Fixed to return an array of NULL values ​​when the target condition value does not exist
1 parent 7bcc338 commit 9a4bae2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/mssql-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class MSSQLHelper {
262262
*/
263263
createInClause(values) {
264264
if (!Array.isArray(values) || values.length === 0) {
265-
return "'^-_'"; // 빈 배열을 존재하지 않을 것 같은 값으로 치환
265+
return "NULL"; // 빈 배열일 경우 NULL 반환 (숫자/문자열 타입 모두 안전)
266266
}
267267

268268
return values.map(v => {

src/variable-processor.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ const messages = {
4242
unresolvedDynamicVar: 'Unresolved dynamic variable',
4343
replacedWith: '→ replaced with',
4444
unresolvedVar: 'Unresolved variable',
45-
emptyString: '→ replaced with empty string'
45+
emptyString: '(empty string)',
46+
nullValue: '(no match)'
4647
},
4748
kr: {
4849
dynamicVarSet: '동적 변수 설정:',
@@ -80,7 +81,8 @@ const messages = {
8081
unresolvedVars: '치환되지 않은 변수들:',
8182
unresolvedDynamicVar: '치환되지 않은 동적 변수',
8283
replacedWith: '→',
83-
emptyString: '로 대체',
84+
emptyString: '(빈 문자열)',
85+
nullValue: '(매칭 없음)',
8486
unresolvedVar: '치환되지 않은 변수'
8587
}
8688
};
@@ -394,17 +396,17 @@ class VariableProcessor {
394396
const fullMatch = match[0];
395397
const varName = match[1];
396398

397-
// 동적 변수의 경우 빈 배열로 대체
399+
// 동적 변수의 경우 NULL로 대체 (IN 절에서 숫자/문자열 타입 모두 안전)
398400
if (this.dynamicVariables.hasOwnProperty(varName.split('.')[0])) {
399-
result = result.replace(fullMatch, "'^-_'");
401+
result = result.replace(fullMatch, "NULL");
400402
if (debugVariables) {
401-
console.log(`${this.msg.unresolvedDynamicVar} [${varName}] ${this.msg.replacedWith} '^-_'${this.msg.emptyString}`);
403+
console.log(`${this.msg.unresolvedDynamicVar} [${varName}] ${this.msg.replacedWith} NULL ${this.msg.nullValue}`);
402404
}
403405
} else {
404406
// 일반 변수의 경우 빈 문자열로 대체
405407
result = result.replace(fullMatch, "''");
406408
if (debugVariables) {
407-
console.log(`${this.msg.unresolvedVar} [${varName}] ${this.msg.replacedWith} ''${this.msg.emptyString}`);
409+
console.log(`${this.msg.unresolvedVar} [${varName}] ${this.msg.replacedWith} '' ${this.msg.emptyString}`);
408410
}
409411
}
410412
});

0 commit comments

Comments
 (0)