At 4:50 PM +0000 1/12/04, Harry Jackson wrote:
done similar to
80 getnext: 81 82 .pcc_begin prototyped 83 .pcc_call fetchrow_hash 84 nextrow: 85 .result rowhash 86 .result answer 87 .pcc_end
where each call to the function will return the hash containg the next rows data.
Yep, that's it. "Here's the result handle, gimme a row of data as a hash". If you want to keep state such that it's a real iterator, that's fine. If you want to leave it so that the user of the library has to be explicit with which row they want, that's fine too.
Ok. I have the following working after a fashion
After connecting and various other contortions we get to the extraction of the data part which involves the following.
133 getnext:
134 onfield = 0
135 .pcc_begin prototyped
136 .pcc_call fetchrow_hash
137 retfetchhash:
138 .result record_hash
139 .result answer
140 .pcc_endWe have returned a Hash where (key,value) = (field_name, data)
The following shows roughly what I had to do to display it. I am using a global HASH called MetaData that stores various bits about the current statement being executed.
141 nextfieldhash:
142
143 FieldData = TupleData[onfield]
144 field_name = FieldData[0]
145
146 value = record_hash[field_name]
147 .PRINT("", value, "#")
148 if onfield == fnum goto nextrowhash
149 inc onfield
150 branch nextfieldhash
151 nextrowhash:
152 print "\n"
153 ne 0, answer, getnextFor the speed freaks displaying 10000 rows to screen takes. This can be improved as much as my code which could be quite a bit.
Rows 9999
real 0m5.436s user 0m1.590s sys 0m0.320s
Do you have any requests for anything else on, around or near this before I start. I should be able to ruffle something up pretty quickly.
Nope, can't think of anything yet.
Phew.
Harry Jackson
