Working with a list of Serial Objects over ODBC
Hi all,
I have a non objectscript application connecting to a cache instance via ODBC and one column is a list of serial objects. The output from the query contains a lot of special characters and I'm hoping there's a better way to get this data back so I won't have to perform extensive parsing on the application side.
I've tried using the $ListToString() function, but that didn't help much, probably because the list contains complex objects rather than primitives.
Any help will be greatly appreciated!
You can project collection property as a child table.
Note that it changes class storage, so existing data should be moved to the correct new place.
Several months ago I wrote a small utility class to accomplish exactly that.
Or if you don't have a lot of different classes and data dependencies, you can just export to XML, add STORAGEDEFAULT and import XML.
Then stored sql procedures/custom queries or result sets are the way to go.
You'll need to write a method that returns what you need and expose it to SQL via one of the abovementioned methods.
Thanks for the answer. Unfortunately, modifying this class isn't an option.
As Eduard mentioned there are a couple of different approaches, depending on what your needs are. Here are some simple classes to use as examples:
Running a simple query produces results with embedded characters and no easy way to parse the list of Pets:
One option is to use a stored function to return a single value when querying a specific PetOwner:
If PetInfo method is in the Demo.Test class, the stored function can be used like this to get a comma-delimited string of pet information where each component of the pet information is separated by a "^":
Another option is to write a custom class query that is called as a stored procedure to return the results as a resultset:
The GetOwnersWithPetDetails method is in the class Demo.Test and information about how to write a custom class query can be found in the Caché documentation.