Mark Miesfeld <miesf...@gmail.com> wrote: > Sorry, I still don't get it. Say you have a table with 6 rows, column 1 > is named A and column 2 is named B. Then you do a select * from that > table. I would view that as > >row A B >============= >1 x y >2 a b >3 e f >4 n m >5 t o >6 q d > >So that the value of row 4 column a was 'n' and the value of row 2 column >b was 'b' > >How do you extract those values from the stem?
say thestem.a.4 etc? I've used stems for years, but I would be ... wary... of using an interface where arbitrary values that might be in conflict with variable names in the exec could end up in stem tails. I mean, suppose you've written an exec to deal with a table which has columns A B C ... in it, then someone changes the table and adds some more columns RA RB... RC What would you do then? I'd be much happier if one simply had numeric indices in the stem, so for example colcc = 1 rowrr = 4 ... say thestem.colcc.rowrr but then I'd want to be able to get a list of the names of the columns in whatever table had been returned from a query. You could create something like: stem.0.0 = number of rows, eg 6 stem.0.1 = list of column names, eg "A B" stem.0.n = any other useful 'state' information stem.r.c = content of c'th column of r'th row In Classic Rexx there's a common convention to give names to parts of tails where the names start with a digit, often "0", so instead of having mystem.this = 7 mystem.that = 4 ... and hope that nothing ever sets a value in this or that, one might code mystem.0this = 7 mystem.0that = 4 and then one has recognisable names for parts of the stem but there's no risk that anything could change the value of '0this'. If you're creating the stem as a result of an SQLite query, you could conceivably create them with these slightly changed index values. This does presume that SQLite column names always start with a letter and are single tokens. > >Regardless of that discussion, I could change the way the returned stem is >created so that this would would work: > > say 'id'~left(6) || 'type_id'~left(8) || 'name'~left(25) > say '='~copies(40) > > do i = 1 to rs.0 > say rs.i.id~left(6) || rs.i.type_id~left(8) || rs.i.name~left(25) > end But this will still fail if someone sets the variable named 'id' or 'name' or 'type_id' to anything different from what it was at the start of the exec. -- Jeremy Nicoll - my opinions are my own ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Oorexx-users mailing list Oorexx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-users