[PyGreSQL] Patch to add read support for integer arrays

D'Arcy J.M. Cain darcy at PyGreSQL.org
Fri Mar 21 11:39:52 EDT 2008


On Fri, 21 Mar 2008 15:56:12 +0200
Mikko Korkalo <mikko at korkalo.fi> wrote:
> 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.

That's nice.  Can you submit the patch as a context diff though?
Sometimes the HEAD has changed enough so that the line numbers are only
approximate.  Context diffs allow us to confirm the position.  Even
clearer is unified diffs.  If you are using diff (or cvs diff) just add
"-u" to get unified diffs.

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

There is some refactoring need in that area.  This might be a good time
to look at that.

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

-- 
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org


More information about the PyGreSQL mailing list