3 messages in com.mysql.lists.javaRE: How to get tablename when aliasin...
FromSent OnAttachments
Helmut Leininger17 May 2003 09:54 
Mark Matthews17 May 2003 14:04 
JR Ruggentaler17 May 2003 21:23 
Subject:RE: How to get tablename when aliasing is used
From:JR Ruggentaler (jr@mpv.com)
Date:05/17/2003 09:23:30 PM
List:com.mysql.lists.java

Could you use select t.col1 as col1, t.col2 as col2 from mytable t?

J.R.

-----Original Message----- From: Mark Matthews [mailto:ma@mysql.com] Sent: Saturday, May 17, 2003 4:05 PM To: Helmut Leininger Cc: ja@lists.mysql.com Subject: Re: How to get tablename when aliasing is used

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Helmut Leininger wrote:

Hi,

I have something like

select t.col1, t.col2 from mytable as t

If I use the ResultSetMetaData method getTableName() it delivers "t". Is there a way to retrieve the origonal table name ("mytable") ?

Thanks Helmut

Only MySQL-4.1 sends the 'original' names as part of the protocol, as MySQL versions prior to 4.1 don't return the non-aliased names. The JDBC API provides no methods to retrieve these names, however. If needed, Connector/J could be extended to allow access to this data (it sometimes uses it internally). Until now, there hasn't been much call for it.

-Mark

- -- For technical support contracts, visit https://order.mysql.com/?ref=mmma

iD8DBQE+xqPxtvXNTca6JD8RAkM4AJ95JvteKf+QDobRa+iWbTPXUbC6FQCgyWu+ 48ISt1HlI59na/JxgF6flA4= =2AbV -----END PGP SIGNATURE-----