Hi Chris, I'm not familiar with the table structure that you're working with
but I can offer a suggestion as to how I've worked out similar problems in
the past.

When I can't quite guess the correct returned data structure, I use IRB at a
command prompt.  I find IRB to be better at trouble-shooting these kinds of
things than working through an IDE.

After you get the 'indexes', what do you get if you print the output?  i.e.
just type 'indexes' at the next line?

Do you see a multi-dimensional array?  Is it a string?  Do you see the data
you're looking for?  IRB's really good about showing you all the correct
brackets and quotation marks.

BTW, you don't really mention what you're trying to do or looking for.  The
loops below seem to work as expected - except for the last one.  Is there
particular data that you don't see?

I usually flatten Arrays Of Arrays when they annoy me. ;)

Let us know what you find.  Cheers.  P.C.


On 09/01/07, Chris McMahon <[EMAIL PROTECTED]> wrote:


Hi...

Help me understand what data structure this is?  Ruby ODBC almost always
returns an ArrayOfArrays, but this is very very weird and I don't understand
what I'm seeing.  (btw, google groups access to comp.lang.ruby is down)

indexes = @conn.indexes('tablename')

  indexes.each do |ind|
 puts ind[5]
    end
=>nil
PK_indexname
XY_indexname2

  indexes.each do |ind|
 puts ind[5]
 puts "hah"
    end
=>nil
hah
PK_indexname
hah
XY_indexname2
hah


  indexes.each do |ind|
 puts ind[5][1]
    end
=>foo_index.rb:122: undefined method `[]' for nil:NilClass (NoMethodError)


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to