I want to fetch some data from my database in a structure so I use the following script:
conn = database('myDB','myUser','myPass','com.mysql.jdbc.Driver','jdbc:mysql://myServer/myDB')setdbprefs('DataReturnFormat','structure')data = fetch(conn,'SELECT `type`,`fetch`,`name` FROM testtable')
I expect to get the requested data but instead I receive:
??? Reference to non-existent field 'Type'. Error in ==> cursor.subsref at 65 eval(tmpcomm) Error in ==> database.fetch at 68 x.(flds{i}) = [x.(flds{i});e.Data.(flds{i})];
If I use the following query:
data = fetch(conn,'SELECT `fetch`,`name` FROM testtable')
I receive:
??? Reference to non-existent field 'Fetch'. Error in ==> cursor.subsref at 65 eval(tmpcomm) Error in ==> database.fetch at 68 x.(flds{i}) = [x.(flds{i});e.Data.(flds{i})];
If I use:
data = fetch(conn,'SELECT `name` FROM testtable')
The data from the name column is returned succesfully; however I also need the data contained in the type and fetch columns. Further, when I use:
c = exec(conn, 'SELECT `type`,`fetch`,`name` FROM testtable');d = fetch(c)
I do not receive any errors, but soon as I try to access my data using:
d.Data.type
I receive:
??? Reference to non-existent field 'Type'. Error in ==> cursor.subsref at 65 eval(tmpcomm)
Best Answer