Redis - HSetmultiple

Im getting an exception of expected $ and got ’ '. I am using HSetMultiple to send a dictionary that containes key names and a value of dictionary which containes name:value pairs of 10 attributes. This works in my test application - seding a string name and a dictionary with 2 key/val - name/val pairs. Do you think Im nto formatting the dictionary contents correctly?

Some sample code would be helpful

This snippet is where its happening and Ive been able to narrow it down to an unexpected disconnect exception in M_Redis but I cant figure out why it one happens in this actual code. If I run it in my test app with a written, single line for the Hsetmultiple it runs through just fine. I have tried a lot of different formatting on the dictionaries below that fuel the call but to no avail. Headers is an array of strings that are the same for each iteration; they are the names of the name/value pairs for the vals dictionary.

My test redis app runs redis with saving unlike Kems examples so I think it may have to do with the bulk insert and a saving trigger in the conf file but I changed this app to run the “no save” setup too and it still does it…Im thinking it must be along this line right now…

headers() as string, vals as dictionary
var r as new Redis_MTC(RedisLocal.RedisPassword,RedisLocal.RedisAddress,RedisLocal.RedisPort)
var result as string
var s as string

var cnt as integer = 0
for each ent as DictionaryEntry in vals
    Catch err as M_Redis.RedisException
    end try
  catch err as M_Redis.RedisException
    Status.Update("outer catch: "+s+"--"+err.Message)
  end try
  Status.WriteLog("added material: "+ent.Key)

When commands are sent to Redis, they are formatted as parameters, so the (now deprecated) HMSET command might look like this:


This tells Redis that there are 6 parameters upcoming (*6), the first is 5 characters ($5), etc.

I suspect in your param list you have either a blank or a stray EOL and my code isn’t prepared for that. Please test that hypothesis and let me know, and I’ll decide if I should add some error-checking there.

I do see *22 which is right for my data *I think. Thats the line of questioning im on, so thats great to hear, thank you. Im pretty sure its an errant string formation somewhere on my part putting the data into the dict. Im reading csv files to populate the data so its back to the primer for me… I saw the deprecated HMSET but Im not to that part yet. Im not sure if want to update the base db or not - at least not yet.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.