[DB-SIG] Parameters in DCOracle2

Marcos Sánchez Provencio msanchez@grupoburke.com
21 Aug 2002 18:02:48 +0200


This is a message for all the people that helped me with my Oracle
'issue'. Some of these answers (a megamix of them, really) have allowed
me to carry on my program. But all of them have given me a feeling that
no matter the problems I have, there is someone in this list that is
able to help fix them. This has allowed me to work without fear of
getting stuck.

So, thank all of you.

El mié, 21-08-2002 a las 15:45, Matthew T. Kromer escribió:
> James Briggs wrote:
> 
> >[...]
> >
> >3) Tweak or Force DCOracle2, or the interface of your choic,e to convert=
 string bind variables to CHAR datatypes not VARCHAR datatypes, using DCOracle2.TypeCoercion??? Not sure this is possible, I haven't had access to a database to test this yet. I do know in the C layer it is possible to define arrays to be mapped to the CHAR type...
> >  
> >
> 
> Yes, that will work.  Here's an example:
> 
> SQL> describe testchar
>  Name                                      Null?    Type
>  ----------------------------------------- -------- 
> ----------------------------
>  ID                                                 NUMBER(38)
>  CS                                                 CHAR(12)
>  VC                                                 VARCHAR2(12)
> 
> SQL> select * from testchar;
> 
>         ID CS           VC
> ---------- ------------ ------------
>          1 MATT         MATT
> 
> 
> 
> import DCOracle2
> db = DCOracle2.connect('scott/tiger')
> c = db.cursor()
> c.execute('select * from testchar where cs=:1',
>     DCOracle2.TypeCoercion('MATT', 'SQLT_AFC'))
> 
> print c.fetchall()
> 
> 
> However, its fairly nonobvious that 'SQLT_AFC' (ANSI Fixed Character) is 
> the type you get when you use datatype 'CHAR' -- you'd expect that to be 
> 'SQLT_CHR' but that's VARCHAR.
> 
> -- 
> Matt Kromer
> Zope Corporation  http://www.zope.com/ 
> 
>