diff --git a/src/drivers/CassandraDriver.ts b/src/drivers/CassandraDriver.ts index 12203cda..c4b5bd4e 100644 --- a/src/drivers/CassandraDriver.ts +++ b/src/drivers/CassandraDriver.ts @@ -66,15 +66,24 @@ export class CassandraDriver implements IRemoteDriver { this.checkConnection(); const queryResult = await this._client!.execute( - `SELECT * FROM ${table} WHERE id LIKE ?`, - [`${query}%`], + `SELECT * FROM ${table}`, { prepare: true } ); - return queryResult.rows.map((row) => ({ - id: row.id, - value: JSON.parse(row.value), - })); + const result = []; + + for (const row of queryResult.rows) { + if (!row.id.startsWith(query)) { + continue; + } + + result.push({ + id: row.id, + value: JSON.parse(row.value), + }); + } + + return result; } public async getRowByKey( diff --git a/src/drivers/SqliteDriver.ts b/src/drivers/SqliteDriver.ts index 544b720d..32f6fec9 100644 --- a/src/drivers/SqliteDriver.ts +++ b/src/drivers/SqliteDriver.ts @@ -71,7 +71,7 @@ export class SqliteDriver implements IDriver { query: string ): Promise<{ id: string; value: any }[]> { const prep = this._database.prepare( - `SELECT json FROM ${table} WHERE ID LIKE '${query}%'` + `SELECT * FROM ${table} WHERE id LIKE '${query}%'` ); const data = [];