Stefano Corsi
2003-05-15 11:14:55 UTC
Is there a way to retrieve a value from the PGResultSet independently from the
column type? In other words, is it possible to retrieve a value without being
forced to try a case like this:
switch (rset.getColumnType(n)) {
case "integer":
int i = rset.getInt(n);
case "String":
String s = rset.getString(n);
...etc...
}
I would like to retrive only strings, even if the column type is an int (thus
somewhere there must be a conversion...).
Is there already a way for doing this in PGSQL.i?
Thanks,
Stefano
P.S I've used perl a lot, so having differences between data types sometimes
is still shocking for me. Perl programmers often forget the difference
between apples and grapes, cars and bicycles, cats and dogs. The world tends
to become a flattened $ish space.
What? Should I use two different types of food(for(@animals)) for my $cat and
my $dog?
column type? In other words, is it possible to retrieve a value without being
forced to try a case like this:
switch (rset.getColumnType(n)) {
case "integer":
int i = rset.getInt(n);
case "String":
String s = rset.getString(n);
...etc...
}
I would like to retrive only strings, even if the column type is an int (thus
somewhere there must be a conversion...).
Is there already a way for doing this in PGSQL.i?
Thanks,
Stefano
P.S I've used perl a lot, so having differences between data types sometimes
is still shocking for me. Perl programmers often forget the difference
between apples and grapes, cars and bicycles, cats and dogs. The world tends
to become a flattened $ish space.
What? Should I use two different types of food(for(@animals)) for my $cat and
my $dog?