File tree 1 file changed +17
-3
lines changed 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -331,10 +331,24 @@ pgresult_fname(VALUE self, VALUE index)
331
331
* call-seq:
332
332
* res.fnumber( name ) -> Fixnum
333
333
*
334
- * Returns the index of the field specified by the string _name_.
334
+ * Returns the index of the field specified by the string +name+.
335
+ * The given +name+ is treated like an identifier in an SQL command, that is,
336
+ * it is downcased unless double-quoted. For example, given a query result
337
+ * generated from the SQL command:
335
338
*
336
- * Raises an ArgumentError if the specified _name_ isn't one of the field names;
337
- * raises a TypeError if _name_ is not a String.
339
+ * result = conn.exec( %{SELECT 1 AS FOO, 2 AS "BAR"} )
340
+ *
341
+ * we would have the results:
342
+ *
343
+ * result.fname( 0 ) # => "foo"
344
+ * result.fname( 1 ) # => "BAR"
345
+ * result.fnumber( "FOO" ) # => 0
346
+ * result.fnumber( "foo" ) # => 0
347
+ * result.fnumber( "BAR" ) # => ArgumentError
348
+ * result.fnumber( %{"BAR"} ) # => 1
349
+ *
350
+ * Raises an ArgumentError if the specified +name+ isn't one of the field names;
351
+ * raises a TypeError if +name+ is not a String.
338
352
*/
339
353
static VALUE
340
354
pgresult_fnumber (VALUE self , VALUE name )
You can’t perform that action at this time.
0 commit comments