Skip to content

Commit 30b137e

Browse files
committed
2 parents c7b9ab2 + fe70d91 commit 30b137e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cache.service.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ export class CacheService {
124124
let type = CacheService.isRequest(data) ? 'request' : typeof data;
125125
let value = JSON.stringify(data);
126126
const valuesMap = { key, value, expire, type, groupKey }
127-
const values = Object.keys(valuesMap).map(key => `'${valuesMap[key]}'`)
127+
const values = Object.keys(valuesMap).map(key => valuesMap[key])
128128

129-
let query = `INSERT OR REPLACE INTO ${this.tableName} (${Object.keys(valuesMap).join(', ')}) VALUES (${values.join(', ')})`;
129+
let query = `INSERT OR REPLACE INTO ${this.tableName} (${Object.keys(valuesMap).join(', ')}) VALUES (${Object.keys(valuesMap).fill('?').join(', ')})`;
130130

131-
return this.storage.query(query).then(() => data);
131+
return this.storage.query(query, values).then(() => data);
132132
}
133133

134134
/**
@@ -324,4 +324,4 @@ export class CacheService {
324324
return false;
325325
}
326326
}
327-
}
327+
}

0 commit comments

Comments
 (0)