On Tue, Oct 30, 2012 at 4:35 PM, Staffan Tylen <staffan.tylen@gmail.com> wrote:

What does that look like?

stm. = dbConn~exe(..)

stm.A.1
stm.A.2
stm.A.3
stm.B.1
stm.B.2
stm.B.3

How do you know how many rows there are?


This is how RexxSQL is creating its output, with stm.A.0, stm.B.0 etc all having the (same) number of rows.


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?

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

and you would get output something like this:

id    type_id name
========================================
86    4       A1 Sauce
213   9       All Day Sucker
212   9       Almond Joy
189   8       Apple

This:

do i = 1 to rs.0
  say rs.i.name
end

Is actually more of the construct I first pictured.  But, my first implementation didn't work correctly and I gave up on that, thinking for some reason that it wasn't possible.

This discussion got me thinking about it again.

This change would mean any one already using the existing format would need to change their code.

I would like to hear what people think?

--
Mark Miesfeld