Discussion:
PGSQL ext...
Stefano Corsi
2003-05-15 11:14:55 UTC
Permalink
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?
Shay Harding
2003-05-15 12:54:26 UTC
Permalink
getString(int index)

-- OR --

getString(String columnName)


Postgres (as well as MySQL) always retrieves data as char*. The Moto PGSQL
code does all the conversions for other data types.




Shay
-----Original Message-----
Sent: Thursday, May 15, 2003 4:15 AM
Subject: [moto-devel] PGSQL ext...
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
switch (rset.getColumnType(n)) {
int i = rset.getInt(n);
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.
for my $cat and
my $dog?
---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.478 / Virus Database: 275 - Release Date: 5/6/2003

Loading...