On Wed, Feb 18, 2004 at 10:56:23AM +0100, Steffen Goeldner wrote:
> Tim Bunce wrote:
> > 
> > On Tue, Feb 10, 2004 at 03:53:16PM -0800, Dean Arnold wrote:
> > > I don't think ODBC provides any clear guidance.
> > > It defines 2 distinct descriptor elements:
> > >
> > > COLUMN_SIZE: the size in bytes
> > > DISPLAY_SIZE: the size in characters
> > >
> > > And PRECISION is only defined wrt numerics;
> > > otherwise, the column descriptors only return OCTET_LENGTH
> > > (aka byte length).
> > 
> > I've dug around in my books and "SQL-99 Complete, Really" says
> > that SQLDescribeCol (which is the relevant function here) uses
> > SQL_DESC_OCTET_LENGTH for the 'Columnsize' of char types.
> 
> SQLColAttribute
> 
>   <http://msdn.microsoft.com/library/en-us/odbc/htm/odch21bpr_10.asp?frame=no>
> 
> is an extensible alternative to SQLDescribeCol. Because DBI's
> statement handle attributes are extensible, isn't SQLColAttribute
> the more relevant function here? If so, why not encourage a DBD to
> support as much SQL_DESC_* attributes as it can?

Sure. How about:

  use DBI qw(:sql_desc);

  $precision = $sth->col_info( 1, SQL_DESC_PRECISION );
  $tablename = $sth->col_info( 1, SQL_DESC_TABLE_NAME );

Patches welcome, naturally :)

Tim.

Reply via email to