[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dbi-dev
Subject:    Re: DBD::ADO: column_info
From:       Steffen Goeldner <s.goeldner () eurodata ! de>
Date:       2001-11-30 10:26:14
[Download RAW message or body]

Steffen Goeldner wrote:
> 
> From the COLUMNS Rowset (adSchemaColumns), we'll need:
> 
>  - DATA_TYPE                     !
>  - IS_NULLABLE                   ? see COLUMN_FLAGS
>  - COLUMN_FLAGS                  ! not all flags, but:
>    - DBCOLUMNFLAGS_ISFIXEDLENGTH !
>    - DBCOLUMNFLAGS_ISLONG        !
>    - DBCOLUMNFLAGS_ISNULLABLE    ? see IS_NULLABLE
>    - DBCOLUMNFLAGS_MAYBENULL     ? see DBCOLUMNFLAGS_ISNULLABLE
>    - ...                         ? e.g. DBCOLUMNFLAGS_ISROWID
> 

DBCOLUMNFLAGS are defined in oledb.h and (AFAIK) not available via
TypeLib. However, there is a quite good match between DBCOLUMNFLAGS
and ADO's FieldAttributeEnum's:

 %DBCOLUMNFLAGS =    #   oledb.h # %FieldAttributeEnum =   # adoint.h
 (                               # (
   ISBOOKMARK        =>      0x1 #
 , MAYDEFER          =>      0x2 #   adFldMayDefer         =>     0x2
 , WRITE             =>      0x4 # , adFldUpdatable        =>     0x4
 , WRITEUNKNOWN      =>      0x8 # , adFldUnknownUpdatable =>     0x8
 , ISFIXEDLENGTH     =>     0x10 # , adFldFixed            =>    0x10
 , ISNULLABLE        =>     0x20 # , adFldIsNullable       =>    0x20
 , MAYBENULL         =>     0x40 # , adFldMayBeNull        =>    0x40
 , ISLONG            =>     0x80 # , adFldLong             =>    0x80
 , ISROWID           =>    0x100 # , adFldRowID            =>   0x100
 , ISROWVER          =>    0x200 # , adFldRowVersion       =>   0x200
 , CACHEDEFERRED     =>   0x1000 # , adFldCacheDeferred    =>  0x1000
 , ISCHAPTER         =>   0x2000 # , adFldIsChapter        =>  0x2000
 , SCALEISNEGATIVE   =>   0x4000 # , adFldNegativeScale    =>  0x4000
 , RESERVED          =>   0x8000 # , adFldKeyColumn        =>  0x8000
 , ISROWURL          =>  0x10000 # , adFldIsRowURL         => 0x10000
 , ISDEFAULTSTREAM   =>  0x20000 # , adFldIsDefaultStream  => 0x20000
 , ISCOLLECTION      =>  0x40000 # , adFldIsCollection     => 0x40000
 , ISSTREAM          =>  0x80000 #
 , ISROWSET          => 0x100000 #
 , ISROW             => 0x200000 #
 , ROWSPECIFICCOLUMN => 0x400000 #
                                 # , adFldUnspecified      =>      -1
 };                              # };

Tom, what's your opinion? Can we use the FieldAttributeEnum's or
should we add %DBCOLUMNFLAGS to DBD::ADO?


> Thus, a DBD::ADO method (to be written!) like:
> 
>    $sql_type = ado2sql( $ado_type, $is_fix, $is_long )
> 
> should give us an appropriate SQL DATA_TYPE (in most cases).
> Finding the TYPE_NAME seems much harder (I think we'll need
> adSchemaProviderType).
> 
> Unfortunately, every source (COLUMNS Rowset, PROVIDER_TYPES Rowset,
> Field object) returns the type info in a slightly different way :-(
> 


Steffen

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic