/*
 * call-seq:
 *   row[position] -> value
 *   row[name] -> value
 *
 * Access elements of this row by column position or name.
 */
static VALUE
pgrow_aref(argc, argv, self)
    int argc;
    VALUE * argv;
    VALUE self;
{
    if (TYPE(argv[0]) == T_STRING) {
        VALUE keys = pgrow_keys(self);
        VALUE index = rb_funcall(keys, rb_intern("index"), 1, argv[0]);
        if (index == Qnil) {
            rb_raise(rb_ePGError, "%s: field not found", StringValuePtr(argv[0]));
        }
        else {
            return rb_ary_entry(self, NUM2INT(index));
        }
    }
    else {
        return rb_call_super(argc, argv);
    }
}