mwilliamson
New member
Hi,
Hope I am not writing this in wrong place.
I am currently porting some of my php API features into my Grails app. The php app was doing data access to a mysql database. And had a command called get_records_sql which return data based on key:value pairs. The key being column name, and value being row result. Example
"[{"id":"1","name":"joe"},{"id":"2","name":"Bob"}]" which was very handy when transforming into JSON as the key value pairs were maintained. And could be passed to views allowing data easily being retrieved via its key.
Now in grails, I have a GORM Domain model which corresponds to my database table. Now with the domain model I execute a query using the same mysql command as I previously used in php. However, this returns the result like follows "[[1,"joe"],[1,"Bob"]]" with no column data attached.
Anyone know if I can use Grails to return data from a database with column data linked to the row result. Hope that makes sense. Appreciated any help
best,
Mark
Hope I am not writing this in wrong place.
I am currently porting some of my php API features into my Grails app. The php app was doing data access to a mysql database. And had a command called get_records_sql which return data based on key:value pairs. The key being column name, and value being row result. Example
"[{"id":"1","name":"joe"},{"id":"2","name":"Bob"}]" which was very handy when transforming into JSON as the key value pairs were maintained. And could be passed to views allowing data easily being retrieved via its key.
Now in grails, I have a GORM Domain model which corresponds to my database table. Now with the domain model I execute a query using the same mysql command as I previously used in php. However, this returns the result like follows "[[1,"joe"],[1,"Bob"]]" with no column data attached.
Anyone know if I can use Grails to return data from a database with column data linked to the row result. Hope that makes sense. Appreciated any help
best,
Mark