Discussion
· Oct 19

Using EnsLib.SQL.Operation.GenericOperation

In the past, I've created custom SQL operations, but now I had something trivial to do, so I decided to take EnsLib.SQL.Operation.GenericOperation out for a spin. There's no example in the docs, so it was a little tricky. Here's what I ended up doing:

In my external database, I have 'mytable' with two fields 'id1' and 'id2'. Here are the pertinent Business Operation settings:

SQL: select id2 from mytable where id1 = ?
Input Parameters: [1] *id1
RequestClass: Ens.StringRequest
ResponseClass: MyResponseClass

To look up 'id2' for the row where 'id1' is "abc", I set 'StringValue' of my request to a JSON string: {"id1":"abc"}

For the result, 'MyResponseClass' has one property 'id2', i.e. identical to my select clause. The way I read the docs, it should be possible to get the result back as JSON in an 'Ens.StreamContainer', but I couldn't get this to work. Has anybody else had better luck?

Discussion (2)2
Log in or sign up to continue