Hi everybody,
at the moemnt I am writing a little app that uses the libpq client
library.
The function PQfnumber returns the column number associated with a
given column name.
Here is the spec of the function:
<snip------------------>
PQfnumber Returns the column number associated with the given column
name.
int PQfnumber(const PGresult *res, const char *column_name);
-1 is returned if the given name does not match any column. The given
name is treated like an identifier in an SQL command,
that is, it is downcased unless double-quoted.
For example, given a query result generated from the SQL command
select 1 as FOO, 2 as "BAR";
we would have the results:
PQfnumber(res, "FOO") 0
PQfnumber(res, "foo") 0
PQfnumber(res, "BAR") -1
PQfnumber(res, "\"BAR\"") 1
<snap------------------->
What happens if the statement looks like:
select 1 as FOO, 2 as FOO; (the database has no probs with that)
What result will PQfnumber return ????
PQfnumber(res, "FOO") 0 or 1 ???
Thx for all help!
Ralf Hasemann