[PyGreSQL] Patch to add read support for integer arrays

Mikko Korkalo mikko at korkalo.fi
Fri Mar 21 09:56:12 EDT 2008


Hi,

I figured pgdb.py (version 1.33) didn't have support to read int2[] and 
int4[] types, so I added support for it. I don't know if this was in the 
CVS/SVN tree already.

When reading data, int2[] and int4[] are now converted to a list 
containing ints, instead of passing them as str, i.e. '{ 1, 2 }' to the 
program.

I don't know if this is the correct way to do this.
Maybe all of the array types should be handled at once?

--------
109a110,114
 >               elif typ == INTARRAY:
 >                       tmp = value.replace("{", "").replace("}", 
"").split(",")
 >                       value=[]
 >                       for v in tmp:
 >                               value.append(int(v))
413a419
 > INTARRAY = pgdbType('_int2', '_int4')
--------

Best Regards,
Mikko Korkalo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgdb.intarray.patch.bz2
Type: application/x-bzip
Size: 188 bytes
Desc: not available
Url : http://mailman.vex.net/pipermail/pygresql/attachments/20080321/7f259481/attachment.bin 


More information about the PyGreSQL mailing list