Skip to content

Commit

Permalink
test: Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
preetyp committed Oct 10, 2023
1 parent 1939729 commit 4d81616
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ldb_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,15 @@ func (reader *LDBReader) GetRowsByKeyPrefixLike(ctx context.Context, familyName
if len(key) == 0 {
globalstats.Incr("full-table-scans", familyName, tableName)
}
rows, err := stmt.QueryContext(ctx, key...)
// Initialize a slice to hold the modified keys
var modifiedKeys []interface{}

for _, k := range key {
// Modify each key to include % characters
modifiedKey := "%" + k.(string) + "%" // Ensure k is converted to a string
modifiedKeys = append(modifiedKeys, modifiedKey)
}
rows, err := stmt.QueryContext(ctx, modifiedKeys...)
switch {
case err == nil:
cols, err := schema.DBColumnMetaFromRows(rows)
Expand Down Expand Up @@ -298,6 +306,8 @@ func (reader *LDBReader) getRowsByKeyPrefixStmtLike(ctx context.Context, pk sche
}
}
qs := strings.Join(qsTokens, " ")
events.Log("query string is %v", qs)
events.Log("query token string is %v", qsTokens)
stmt, err := reader.Db.PrepareContext(ctx, qs)
if err == nil {
reader.getRowsByKeyPrefixStmtCache[pck] = stmt
Expand Down

0 comments on commit 4d81616

Please sign in to comment.