You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(52) |
Oct
(21) |
Nov
(10) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(3) |
Feb
(7) |
Mar
|
Apr
(8) |
May
(1) |
Jun
(6) |
Jul
(4) |
Aug
(4) |
Sep
(18) |
Oct
(26) |
Nov
(7) |
Dec
(25) |
2003 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(10) |
Jul
(10) |
Aug
|
Sep
|
Oct
(5) |
Nov
(2) |
Dec
(2) |
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
(8) |
Apr
(1) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:45:32
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv11701 Modified Files: pgversion.c Log Message: 16SEP2002 gh Reflect the change to the unconditionally included pg_strtok_r. Index: pgversion.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgversion.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pgversion.c 5 Jun 2002 09:17:35 -0000 1.16 --- pgversion.c 16 Sep 2002 05:45:29 -0000 1.17 *************** *** 32,35 **** --- 32,37 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 16SEP2002 gh Reflect the change to the unconditionally included | + | pg_strtok_r. | | 16APR2002 gh Replace _tolower with the standard C tolower function, | | to make this file compile on FreeBSD. | *************** *** 123,127 **** static int pgstricmp(char *s1, char *s2) { ! int c1, c2; for (;(*s1 != 0) && (*s2 != 0); s1++, s2++) --- 125,129 ---- static int pgstricmp(char *s1, char *s2) { ! int c1 = 0, c2 = 0; for (;(*s1 != 0) && (*s2 != 0); s1++, s2++) *************** *** 206,210 **** char *vstr; /* The version number from the version string */ char *token; /* parsed token */ ! char *save_ptr; /* saves strtok_r state for subsequent calls */ long major, minor, patch, value; --- 208,212 ---- char *vstr; /* The version number from the version string */ char *token; /* parsed token */ ! char *save_ptr; /* saves pg_strtok_r state for subsequent calls */ long major, minor, patch, value; *************** *** 242,252 **** ! token = strtok_r(s, " \t", &save_ptr); if (strcmp(token, "PostgreSQL") != 0) goto new_error; ! vstr = strtok_r((char *)NULL, " \t", &save_ptr); ! token = strtok_r((char *)NULL, " \t", &save_ptr); if (strcmp(token, "on") != 0) goto new_error; --- 244,254 ---- ! token = pg_strtok_r(s, " \t", &save_ptr); if (strcmp(token, "PostgreSQL") != 0) goto new_error; ! vstr = pg_strtok_r((char *)NULL, " \t", &save_ptr); ! token = pg_strtok_r((char *)NULL, " \t", &save_ptr); if (strcmp(token, "on") != 0) goto new_error; *************** *** 257,261 **** \***************************************************************/ ! token = strtok_r((char *)NULL, " \t", &save_ptr); if (strcmp(token, "on") == 0) goto new_error; --- 259,263 ---- \***************************************************************/ ! token = pg_strtok_r((char *)NULL, " \t", &save_ptr); if (strcmp(token, "on") == 0) goto new_error; *************** *** 268,281 **** save_ptr = (char *)NULL; ! token = strtok_r(vstr, ".", &save_ptr); if (parseToken(token, &major)) goto new_error; ! token = strtok_r((char *)NULL, ".", &save_ptr); if ((token != (char *)NULL) && (*token != '\0') && (parseToken(token, &minor))) goto new_error; ! token = strtok_r((char *)NULL, ".", &save_ptr); if ((token != (char *)NULL) && (*token != '\0') && (parseToken(token, &patch))) --- 270,283 ---- save_ptr = (char *)NULL; ! token = pg_strtok_r(vstr, ".", &save_ptr); if (parseToken(token, &major)) goto new_error; ! token = pg_strtok_r((char *)NULL, ".", &save_ptr); if ((token != (char *)NULL) && (*token != '\0') && (parseToken(token, &minor))) goto new_error; ! token = pg_strtok_r((char *)NULL, ".", &save_ptr); if ((token != (char *)NULL) && (*token != '\0') && (parseToken(token, &patch))) |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:43:07
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv10717 Modified Files: MANIFEST.in Log Message: 16SEP2002 gh Reflect the change from windows/ port port/. Index: MANIFEST.in =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/MANIFEST.in,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MANIFEST.in 3 Aug 2001 23:13:54 -0000 1.3 --- MANIFEST.in 16 Sep 2002 05:43:04 -0000 1.4 *************** *** 2,4 **** recursive-include examples *.py recursive-include test *.py ! recursive-include windows *.c *.h --- 2,4 ---- recursive-include examples *.py recursive-include test *.py ! recursive-include port *.c *.h |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:42:09
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv10423 Modified Files: pgint8object.c Log Message: 16SEP2002 gh Reflect the change from windows/ to port/. Index: pgint8object.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgint8object.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pgint8object.c 5 Oct 2001 08:22:18 -0000 1.11 --- pgint8object.c 16 Sep 2002 05:42:06 -0000 1.12 *************** *** 33,37 **** | Ini Name | | --- ----------------------------------------------------------------- | ! | gh Gerhard Haering <ge...@bi...> | | bga Billy G. Allie <bil...@mu...> | |=======================================================================| --- 33,37 ---- | Ini Name | | --- ----------------------------------------------------------------- | ! | gh Gerhard Haering <ger...@gm...> | | bga Billy G. Allie <bil...@mu...> | |=======================================================================| *************** *** 40,43 **** --- 40,44 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 16SEP2002 gh Reflect the change from windows/ to port/. | | 01OCT2001 bga Changed all new style comments to original style. | | 26SEP2001 bga Change the constructors so that they return PyObject * | *************** *** 70,78 **** #include "Python.h" - #if defined(_MSC_VER) - /* MS Visual C++ */ - #include "windows/llsupport.h" - #endif - #include "libpqmodule.h" --- 71,74 ---- *************** *** 171,177 **** errno = 0; if (base == 0 && s[0] == '0') ! x = strtoull(s, &end, base); else ! x = strtoll(s, &end, base); if (end == s || !isalnum(Py_CHARMASK((unsigned int)(end[-1])))) goto bad; --- 167,173 ---- errno = 0; if (base == 0 && s[0] == '0') ! x = pg_strtoull(s, &end, base); else ! x = pg_strtoll(s, &end, base); if (end == s || !isalnum(Py_CHARMASK((unsigned int)(end[-1])))) goto bad; |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:39:53
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv9795 Modified Files: setup.py Added Files: setup.config Log Message: 16SEP2002 gh Total rework of setup.py to work out of the box for most popular platforms. --- NEW FILE: setup.config --- # This file is for customizing the pyPgSQL build process. On most platforms, # pyPgSQL will build ok with the semi-intelligent setup.py. If you have a # platform that's not supported by default in setup.py, or you want any # nonstandard settings, like building against your own PostgreSQL instead of # the default PostgreSQL of your OS, you'll have to edit this file. # If you want to use this file, you MUST uncomment and set the following two # variables: # include_dirs = ["/usr/local/postgresql70/include"] # library_dirs = ["/usr/local/postgresql70/lib"] # Additionally, you CAN modifiy sources, pypgsql_rt_dirs and optional_libs: # sources += ["support_for_weird_platform.c"] # pypgsql_rt_dirs = library_dirs # optional_libs += ["ssl", "crypto"] Index: setup.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/setup.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** setup.py 8 Sep 2002 16:38:27 -0000 1.16 --- setup.py 16 Sep 2002 05:39:50 -0000 1.17 *************** *** 4,8 **** # Name: setup.py | # | ! # Synopsys: python setup.py build # Build the module. | # python setup.py install # Install the module. | # | --- 4,8 ---- # Name: setup.py | # | ! # Synopsis: python setup.py build # Build the module. | # python setup.py install # Install the module. | # | *************** *** 12,23 **** # | # Description: Setup script (using the distutils framework) for | ! # pyPgSQL Version 2.2. | ! # | ! # Note: This script requires the distutils package (standard in | ! # Python 1.6 or later). For earlier versions of Python, | ! # you can download distutils from: | ! # http://www.python.org/sigs/distutils-sig/download.html | #=======================================================================| ! # Copyright 2001 by Gerhard Haering. | # All rights reserved. | # | --- 12,18 ---- # | # Description: Setup script (using the distutils framework) for | ! # pyPgSQL. | #=======================================================================| ! # Copyright 2001, 2002 by Gerhard Haering. | # All rights reserved. | # | *************** *** 42,46 **** # Ini Name | # --- ----------------------------------------------------------------- | ! # gh Gerhard Haering <ge...@bi...> | # bga Billy G. Allie <bil...@mu...> | #=======================================================================| --- 37,41 ---- # Ini Name | # --- ----------------------------------------------------------------- | ! # gh Gerhard Haering <ger...@gm...> | # bga Billy G. Allie <bil...@mu...> | #=======================================================================| *************** *** 49,54 **** # Date Ini Description | # --------- --- ------------------------------------------------------- | # 29AUG2001 gh Reflected changed PostgreSQL win32 build process (Post- | ! # greSQL now built with mingw32) | # 28AUG2001 bga Add include_dirs and lib_dirs for building on cygwin. | # This change should allow pyPgSQL to build 'out of the | --- 44,52 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 16SEP2002 gh Total rework to make setup.py work out of the box for | + # most popular platforms, while still allowing flexibi- | + # lity through setup.config. | # 29AUG2001 gh Reflected changed PostgreSQL win32 build process (Post- | ! # greSQL now built with mingw32) | # 28AUG2001 bga Add include_dirs and lib_dirs for building on cygwin. | # This change should allow pyPgSQL to build 'out of the | *************** *** 64,154 **** # 01JUN2001 gh Initial version created by Gerhard Haering. | #-----------------------------------------------------------------------+ ! import sys from distutils.core import setup from distutils.extension import Extension ! __version__ = "2.2" # Define the runtime library path for this module. It starts out as None. ! pypgsql_rt_dirs = None ! ! # You may have to adjust include_dirs and library_dirs if they are differant ! # on your system ! ! include_dirs = [ "/usr/local/pgsql/include" ] ! # include_dirs = [ "/usr/local/include/pgsql" ] # Common alternative ! # include_dirs = [ "/usr/include/pgsql" ] # Common alternative ! ! library_dirs = [ "/usr/local/pgsql/lib" ] # Common alternative ! # library_dirs = [ "/usr/local/lib/pgsql" ] # Common alternative ! # library_dirs = [ "/usr/lib/pgsql" ] ! ! optional_libs = [ "pq" ] ! ! sources = [ "libpqmodule.c", "pgboolean.c", ! "pgint2object.c", "pgint8object.c", ! "pgversion.c", "pglargeobject.c", ! "pgnotify.c", "pgconnection.c", ! "pgresult.c", "pymemstrdup.c" ] ! ! if sys.platform == "win32": ! # This works with the PostgreSQL source tree, so it's a bit ugly ... ! # You will probably have to change win_pg_build_root for your system. ! ! win_pg_build_root = "h:/src/postgresql-7.2.1/" ! include_dirs = [ win_pg_build_root + "src/include", ! win_pg_build_root + "/src/include/libpq", ! win_pg_build_root + "src", ! win_pg_build_root + "src/interfaces/libpq" ] ! library_dirs = [ win_pg_build_root + "src/interfaces/libpq/" ] ! optional_libs = [ "wsock32", "advapi32" ] ! optional_libs += [ "pq", "wsock32" ] ! data_files = [] ! sources = sources + [ "windows/strtoll.c", ! "windows/strtoull.c", ! "windows/strtok.c" ] ! modname="pyPgSQL.libpq.libpq" ! else: ! if sys.platform[:6] == "cygwin": ! sources = sources + [ "windows/strtoll.c", ! "windows/strtoull.c", ! "windows/strtok.c" ] ! include_dirs = [ "/usr/include/postgresql" ] ! library_dirs = [ "/usr/lib" ] ! # XXX: This is an ugly hack to make bdist_rpm find the include files. ! include_dirs.append("../" * 5) ! data_files = [] ! pypgsql_rt_dirs = library_dirs ! modname="pyPgSQL.libpq.libpqmodule" ! setup ( ! name = "pyPgSQL", ! version = __version__, ! description = \ ! "pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL.", ! author = "Billy G. Allie", ! author_email = "bal...@so...", ! url = "http://pypgsql.sourceforge.net/", ! licence = "Python", ! packages = [ "pyPgSQL", "pyPgSQL.libpq" ], ! ext_modules = [Extension( ! name=modname, ! sources = sources, ! include_dirs = include_dirs, ! library_dirs = library_dirs, ! runtime_library_dirs = pypgsql_rt_dirs, ! libraries = optional_libs ! )], ! data_files = data_files ! ) --- 62,201 ---- # 01JUN2001 gh Initial version created by Gerhard Haering. | #-----------------------------------------------------------------------+ ! import os, os.path, sys from distutils.core import setup from distutils.extension import Extension ! __version__ = "2.3" # Define the runtime library path for this module. It starts out as None. ! class UnknownPlatformError(Exception): ! pass ! def getLinuxDistribution(): ! f = open("/etc/issue") ! issue = f.read() ! f.close() ! if issue.find("Debian GNU") >= 0: ! return "Debian" ! elif issue.find("Red Hat Linux") >= 0: ! return "Redhat" ! elif issue.find("SuSE Linux") >= 0: ! return "SuSE" ! elif issue.find("Mandrake") >= 0: ! return "Mandrake" ! else: ! return "unknown" ! class Config: ! def __init__(self): ! # Default settings, may be overriden for specific platforms ! self.pypgsql_rt_dirs = None ! self.optional_libs = ["pq"] ! self.modname = "pyPgSQL.libpq.libpqmodule" ! self.sources = ["libpqmodule.c", "pgboolean.c", ! "pgint2object.c", "pgint8object.c", ! "pgversion.c", "pglargeobject.c", ! "pgnotify.c", "pgconnection.c", ! "pgresult.c", "pymemstrdup.c", ! "port/strtoll.c", "port/strtoull.c", ! "port/strtok.c"] ! imported_locals = {} ! execfile("setup.config", {}, imported_locals) ! self.use_custom = len(imported_locals) > 0 ! if self.use_custom: ! for k, v in imported_locals.items(): ! self.__dict__[k] = v ! def main(): ! cfg = Config() ! if cfg.use_custom: ! pass ! elif sys.platform == "linux2": ! distribution = getLinuxDistribution() ! if distribution == "Redhat": ! cfg.include_dirs = ["/usr/include"] ! cfg.library_dirs = ["/usr/lib"] ! elif distribution == "Debian": ! cfg.include_dirs = ["/usr/include/postgresql"] ! cfg.library_dirs = ["/usr/lib"] ! elif distribution in ("SuSE", "Mandrake"): ! cfg.include_dirs = ["/usr/include/pgsql"] ! cfg.library_dirs = ["/usr/lib"] ! else: ! raise UnknownPlatformError, "Unknown Linux distribution." ! # XXX: This is an ugly hack to make bdist_rpm find the include files. ! cfg.include_dirs.append("../" * 5) ! elif sys.platform == "freebsd4": ! LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') ! cfg.include_dirs = ['%s/include' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] ! elif sys.platform == "openbsd3": ! LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') ! cfg.include_dirs = ['%s/include/postgresql' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] ! elif sys.platform == "netbsd1": ! LOCALBASE = os.environ.get('LOCALBASE', '/usr/pkg') ! cfg.include_dirs = ['%s/include/pgsql' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] ! elif sys.platform == "cygwin": ! cfg.include_dirs = ["/usr/include/postgresql"] ! cfg.library_dirs = ["/usr/lib"] ! elif sys.platform == "darwin": # Mac OS X ! cfg.include_dirs = ["/usr/local/pgsql/include"] ! cfg.library_dirs = ["/usr/local/pgsql/lib"] ! cfg.optional_libs += ["ssl", "crypto"] ! elif sys.platform == "win32": ! # This works with the PostgreSQL source tree, so it's a bit ugly ... ! win_pg_build_root = os.getenv("PG_SRC", "../postgresql") ! cfg.include_dirs = [os.path.join(win_pg_build_root, p) for p in ! ["src/include", ! "src/include/libpq", ! "src", ! "src/interfaces/libpq"]] ! cfg.library_dirs = [win_pg_build_root + "/src/interfaces/libpq/"] ! cfg.optional_libs += ["wsock32", "advapi32"] ! cfg.modname="pyPgSQL.libpq.libpq" ! else: ! raise UnknownPlatformError, "Unknown platform." ! setup ( ! name = "pyPgSQL", ! version = __version__, ! description = \ ! "pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL.", ! author = "Billy G. Allie", ! author_email = "bal...@so...", ! url = "http://pypgsql.sourceforge.net/", ! licence = "Python", ! packages = ["pyPgSQL", "pyPgSQL.libpq"], ! ext_modules = [Extension( ! name=cfg.modname, ! sources = cfg.sources, ! include_dirs = cfg.include_dirs, ! library_dirs = cfg.library_dirs, ! runtime_library_dirs = cfg.pypgsql_rt_dirs, ! libraries = cfg.optional_libs ! )] ! ) ! if __name__ == "__main__": ! try: ! main() ! except UnknownPlatformError, reason: ! print "Cannot build pyPgSQL:", reason ! print ! print "setup.py can't guess the correct settings for your platform." ! print ! print "Please manually edit setup.conf appropriately for your platform." ! print "If you have any problems, please ask on the pypgsql-users mailing list." ! print ! print "Once you've managed to build pyPgSQL on your platform, please submit a" ! print "patch to setup.py so that we can support your platform by default in" ! print "the future. The pyPgSQL developers are happy to assist you in doing so." |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:33:48
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv7350 Modified Files: pyPgSQL.spec Log Message: 16SEP2002 gh Updated .spec file from jafo. Closes patch #605455. Index: pyPgSQL.spec =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL.spec,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pyPgSQL.spec 8 Sep 2002 15:31:26 -0000 1.1 --- pyPgSQL.spec 16 Sep 2002 05:33:46 -0000 1.2 *************** *** 1,5 **** %define name pyPgSQL %define version 2.2 ! %define release 1 Summary: pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL. --- 1,5 ---- %define name pyPgSQL %define version 2.2 ! %define release 2 Summary: pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL. *************** *** 16,19 **** --- 16,22 ---- Requires: egenix-mx-base Requires: python2 + Requires: postgresql-libs + BuildPrereq: python2-devel + BuildPrereq: postgresql-devel %description *************** *** 32,35 **** --- 35,47 ---- env CFLAGS="$RPM_OPT_FLAGS" /usr/bin/python2 setup.py build + # change the path in the test/examples + find test examples -type f | while read file + do + echo "Fixing path in $file" + sed 's|^#!.*|#!/usr/bin/env python2|' <$file >/tmp/pathrep.$$ + cat </tmp/pathrep.$$ >$file + rm -f /tmp/pathrep.$$ + done + %install /usr/bin/python2 setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES *************** *** 39,50 **** %files -f INSTALLED_FILES ! %doc README %defattr(-,root,root) %changelog * Sun Sep 08 2002 Gerhard Häring <ger...@gm...> - - Updated to version 2.1. - Changed copyright to 'BSD' ! - Added README to %doc * Fri Sep 06 2002 Sean Reifschneider <jaf...@tu...> - Updated to version 2.1. --- 51,70 ---- %files -f INSTALLED_FILES ! %doc README Announce ChangeLog ! %doc examples test %defattr(-,root,root) %changelog + * Sun Sep 08 2002 Sean Reifschneider <jaf...@tu...> + - Updated to version 2.2. + - Added README to %doc (suggested by Gerhard Häring) + - Added examples, test, Announce and ChangeLog to %doc + - Added postgresql-devel to BuildPrereq and postgresql-libs to requires + (suggested by Gerhard Häring). + - Fix the path in the examples. + * Sun Sep 08 2002 Gerhard Häring <ger...@gm...> - Changed copyright to 'BSD' ! * Fri Sep 06 2002 Sean Reifschneider <jaf...@tu...> - Updated to version 2.1. |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:28:17
|
Update of /cvsroot/pypgsql/pypgsql/port In directory usw-pr-cvs1:/tmp/cvs-serv6269/port Added Files: port.h strtok.c strtoll.c strtoull.c Log Message: 16SEP2002 gh Unconditionally use the functions that used to be in the windows/ directory. They are moved to the port/ directory and all get a pg_ prefix. --- NEW FILE: port.h --- #if ! defined(PYPGSQL_COMPAT_H) #define PYPGSQL_COMPAT_H /********************************************************************** * Get various constants for LONG_LONG and unsigned LONG_LONG defined * **********************************************************************/ #include <limits.h> #ifdef MS_WIN32 #ifndef LLONG_MAX #define LLONG_MAX _I64_MAX #endif #ifndef ULLONG_MAX #define ULLONG_MAX _UI64_MAX #endif #ifndef LLONG_MIN #define LLONG_MIN _I64_MIN #endif #endif /* MS_WIN32 */ /* Some braindead combinations of compilers don't get the constants defined, * for example gcc 2.95.x and Linux glibc. We do their work for them: */ #if !defined(LLONG_MAX) #define LL_LITERAL(x) x##LL #define ULL_LITERAL(x) x##ULL #define ULLONG_MAX (~ULL_LITERAL(0)) #define LLONG_MAX (ULLONG_MAX/2) #define LLONG_MIN (-(ULLONG_MAX/2)+1) #endif /* !defined(LLONG_MAX) */ /******************************************************* * Prototypes for the string functions that we include * *******************************************************/ char * pg_strtok_r(char *s, const char *delim, char **last); char * pg_strtok(char *s, const char *delim); LONG_LONG pg_strtoll(const char *nptr, char **endptr, register int base); unsigned LONG_LONG pg_strtoull(const char *nptr, char **endptr, register int base); #endif /* !defined(PYPGSQL_COMPAT_H) */ --- NEW FILE: strtok.c --- /* * Copyright (c) 1998 Softweyr LLC. All rights reserved. * * strtok_r, from Berkeley strtok * Oct 13, 1998 by Wes Peters <we...@so...> * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notices, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notices, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * * This product includes software developed by Softweyr LLC, the * University of California, Berkeley, and its contributors. * * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef lint static const char rcsid[] = "$FreeBSD: src/lib/libc/string/strtok.c,v 1.3 2001/05/24 08:47:41 obrien Exp $"; #endif #include <stddef.h> #include <string.h> char * pg_strtok_r(char *s, const char *delim, char **last) { char *spanp; int c, sc; char *tok; if (s == NULL && (s = *last) == NULL) { return NULL; } /* * Skip (span) leading delimiters (s += strspn(s, delim), sort of). */ cont: c = *s++; for (spanp = (char *)delim; (sc = *spanp++) != 0; ) { if (c == sc) { goto cont; } } if (c == 0) /* no non-delimiter characters */ { *last = NULL; return NULL; } tok = s - 1; /* * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). * Note that delim must have one NUL; we stop if we see that, too. */ for (;;) { c = *s++; spanp = (char *)delim; do { if ((sc = *spanp++) == c) { if (c == 0) { s = NULL; } else { char *w = s - 1; *w = '\0'; } *last = s; return tok; } } while (sc != 0); } /* NOTREACHED */ } char * pg_strtok(char *s, const char *delim) { static char *last; return pg_strtok_r(s, delim, &last); } #if defined(DEBUG_STRTOK) /* * Test the tokenizer. */ int main() { char test[80], blah[80]; char *sep = "\\/:;=-"; char *word, *phrase, *brkt, *brkb; printf("String tokenizer test:\n"); strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function."); for (word = strtok(test, sep); word; word = strtok(NULL, sep)) { printf("Next word is \"%s\".\n", word); } phrase = "foo"; strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function."); for (word = strtok_r(test, sep, &brkt); word; word = strtok_r(NULL, sep, &brkt)) { strcpy(blah, "blah:blat:blab:blag"); for (phrase = strtok_r(blah, sep, &brkb); phrase; phrase = strtok_r(NULL, sep, &brkb)) { printf("So far we're at %s:%s\n", word, phrase); } } return 0; } #endif /* DEBUG_STRTOK */ --- NEW FILE: strtoll.c --- /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #ifndef lint static const char rcsid[] = "$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.5.2.1 2001/03/02 09:45:20 obrien Exp $"; #endif #include <sys/types.h> #include <limits.h> #include <errno.h> #include <ctype.h> #include <stdlib.h> #include "Python.h" #include "port.h" /* * Convert a string to a LONG_LONG integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ LONG_LONG pg_strtoll(const char *nptr, char **endptr, register int base) { register const char *s; register unsigned LONG_LONG acc; register unsigned char c; register unsigned LONG_LONG qbase, cutoff; register int neg, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. * If base is 0, allow 0x for hex and 0 for octal, else * assume decimal; if base is already 16, allow 0x. */ s = nptr; do { c = *s++; } while (isspace(c)); if (c == '-') { neg = 1; c = *s++; } else { neg = 0; if (c == '+') c = *s++; } if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { c = s[1]; s += 2; base = 16; } if (base == 0) base = c == '0' ? 8 : 10; /* * Compute the cutoff value between legal numbers and illegal * numbers. That is the largest legal value, divided by the * base. An input number that is greater than this value, if * followed by a legal input character, is too big. One that * is equal to this value may be valid or not; the limit * between valid and invalid numbers is then based on the last * digit. For instance, if the range for quads is * [-9223372036854775808..9223372036854775807] and the input base * is 10, cutoff will be set to 922337203685477580 and cutlim to * either 7 (neg==0) or 8 (neg==1), meaning that if we have * accumulated a value > 922337203685477580, or equal but the * next digit is > 7 (or 8), the number is too big, and we will * return a range error. * * Set any if any `digits' consumed; make it negative to indicate * overflow. */ qbase = (unsigned)base; cutoff = neg ? (unsigned LONG_LONG)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX : LLONG_MAX; cutlim = cutoff % qbase; cutoff /= qbase; for (acc = 0, any = 0;; c = *s++) { if (!isascii(c)) break; if (isdigit(c)) c -= '0'; else if (isalpha(c)) c -= isupper(c) ? 'A' - 10 : 'a' - 10; else break; if (c >= base) break; if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; acc *= qbase; acc += c; } } if (any < 0) { acc = neg ? LLONG_MIN : LLONG_MAX; errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) *endptr = (char *)(any ? s - 1 : nptr); return (acc); } --- NEW FILE: strtoull.c --- /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #ifndef lint static const char rcsid[] = "$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.5.2.1 2001/03/02 09:45:20 obrien Exp $"; #endif #include <sys/types.h> #include <errno.h> #include <ctype.h> #include <stdlib.h> #include "Python.h" #include <limits.h> #include "port.h" /* * Convert a string to an unsigned LONG_LONG integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ unsigned LONG_LONG pg_strtoull(const char *nptr, char **endptr, register int base) { register const char *s = nptr; register unsigned LONG_LONG acc; register unsigned char c; register unsigned LONG_LONG qbase, cutoff; register int neg, any, cutlim; /* * See strtoq for comments as to the logic used. */ s = nptr; do { c = *s++; } while (isspace(c)); if (c == '-') { neg = 1; c = *s++; } else { neg = 0; if (c == '+') c = *s++; } if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { c = s[1]; s += 2; base = 16; } if (base == 0) base = c == '0' ? 8 : 10; qbase = (unsigned)base; cutoff = (unsigned LONG_LONG)ULLONG_MAX / qbase; cutlim = (unsigned LONG_LONG)ULLONG_MAX % qbase; for (acc = 0, any = 0;; c = *s++) { if (!isascii(c)) break; if (isdigit(c)) c -= '0'; else if (isalpha(c)) c -= isupper(c) ? 'A' - 10 : 'a' - 10; else break; if (c >= base) break; if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; acc *= qbase; acc += c; } } if (any < 0) { acc = ULLONG_MAX; errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) *endptr = (char *)(any ? s - 1 : nptr); return (acc); } |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:28:17
|
Update of /cvsroot/pypgsql/pypgsql/windows In directory usw-pr-cvs1:/tmp/cvs-serv6269/windows Removed Files: llsupport.h strtok.c strtoll.c strtoull.c Log Message: 16SEP2002 gh Unconditionally use the functions that used to be in the windows/ directory. They are moved to the port/ directory and all get a pg_ prefix. --- llsupport.h DELETED --- --- strtok.c DELETED --- --- strtoll.c DELETED --- --- strtoull.c DELETED --- |
From: Gerhard H?r. <gha...@us...> - 2002-09-16 05:24:56
|
Update of /cvsroot/pypgsql/pypgsql/port In directory usw-pr-cvs1:/tmp/cvs-serv5807/port Log Message: Directory /cvsroot/pypgsql/pypgsql/port added to the repository |
From: Gerhard H?r. <gha...@us...> - 2002-09-09 00:03:46
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv13799 Added Files: TODO Log Message: 09SEP2002 gh Initial addition of TODO list for further development. --- NEW FILE: TODO --- TODO list for pyPgSQL ===================== ident "@(#) $Id: TODO,v 1.1 2002/09/09 00:03:44 ghaering Exp $" DATA TYPES ========== * Unicode support - Add automatic encoding conversion to the last patch on Sourceforge. (gh) * transparent use of refcursors returned from execute/callproc. This will require the addition of a type that reflects PostgreSQL cursor objects (in contrast to Python DB-API cursor objects). This object will be very similar to Python DB-API cursor objects, but not have any execute or callproc methods * a PgArray type for PostgreSQL ARRAYs. lists and tuples are no longer converted to PostgreSQL ARRAYs, but are instead quoted for insertion into the SQL IN function * support for all standard PostgreSQL data types (point, line, box, etc.) [This could be placed into pyPgSQL 2.x later] * An easy to use method (api hook) for adding support for user defined types. * Investigate trimming down the TypeCache class - why does it need to be able to typecast PostgreSQL types? Isn't it enough to just convert from string to PostgreSQL data type? PERFORMANCE =========== * profiling, to find out which parts are worth optimizing in Python or rewriting in C * performance optimization of typecasts (archictecture changes) o long term way (v3): do all typecasting for the retrieved rows at once. Remember the order of typecasters to apply (see below) o short term way to improve performance: add a method getTypeCasters() to TypeCache. This gets cursor.description as an attribute and returns a list of typecasting callables. We'll have to do constructs similar to "casters.append(lambda x: x or None and PgInt8)" to do so. A simplistic benchmark shows that this can cut time a __fetchOneRow takes to 50 % * Investigate ways to improve the performance of PgResultSets (rewrite in C and/or possible adaptation of Python Database Row Module from http://opensource.theopalgroup.com/) SOURCE CODE =========== DOCUMENTATION ============= * user's guide, using Docbook/XML, adapting from Redhat Database Documentation (I've got the ok from its author) BUILDING ======== MISC ==== * Make all classes in pyPgSQL/libpq new style classes. * move certain settings from module-level to connection level (fetchReturnsList, noPostgresCursor) Developers who have claimed items are: -------------------------------------- * bga is Billy G. Allie <bil...@mu...> * gh is Gerhard Häring <ger...@gm...> |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 16:38:30
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv4638 Modified Files: setup.py Log Message: 08SEP2002 gh Update for version 2.2. Index: setup.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/setup.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** setup.py 5 Jun 2002 09:14:11 -0000 1.15 --- setup.py 8 Sep 2002 16:38:27 -0000 1.16 *************** *** 12,16 **** # | # Description: Setup script (using the distutils framework) for | ! # pyPgsql Version 2.1. | # | # Note: This script requires the distutils package (standard in | --- 12,16 ---- # | # Description: Setup script (using the distutils framework) for | ! # pyPgSQL Version 2.2. | # | # Note: This script requires the distutils package (standard in | *************** *** 69,73 **** from distutils.extension import Extension ! __version__ = "2.1" # Define the runtime library path for this module. It starts out as None. --- 69,73 ---- from distutils.extension import Extension ! __version__ = "2.2" # Define the runtime library path for this module. It starts out as None. |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 16:18:35
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv31443 Modified Files: ChangeLog Log Message: 08SEP2002 gh Updated changelog for pyPgSQL 2.2. Index: ChangeLog =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/ChangeLog,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ChangeLog 5 Jun 2002 08:27:06 -0000 1.15 --- ChangeLog 8 Sep 2002 16:18:30 -0000 1.16 *************** *** 1,4 **** --- 1,47 ---- #ident "$Id$" + Changes since pyPgSQL Version 2.1 + ================================= + + The following source code files were added to Version 2.2 of pyPgSQL: + + pyPgSQL.spec - RPM spec file, contributed by Sean Reifschneider. + + Changes to README + ----------------- + * Added note about case-insensitiveness of column access in PgResultSet. + + Changes to PgSQL.py + ------------------- + * Fixed various problems with the PgResultSet: Column (attribute and + dictionary) access is now case-insensitive. A __contains__ method was added + and the __setattr__ method was fixed. The get method got an optional default + value parameter. + + * Fixed various problems with the PgNumeric type: + - Added code to allow a float as an argument to the PgNumeric constructor. + - You can now change the precision/scale of a PgNumeric by: + a = PgNumeric(pgnumeric, new prec, new scale). + This can be used to 'cast' a PgNumeric to the proper precision and scale + before storing it in a field. + - The arithmatic routines (__add__, __radd__, etc) now ensure that the + arguments are properly coerced to the correct types. + - Added support for the augmented arithmetic operations (__iadd__, etc). + - The math routines would lose precision because the precision/ scale were + set to be the same as the first operand. This is no longer the case all + precision is retained for the +, -, and * operations. + + * Fixed problem that occurs when a query on an OID field doesn't return any + rows. [Bug #589370]. + + * Applied patch #569203 and also added __pos__ and __abs__ special methods to + PgNumeric. + + * Ensure proper SQL-quoting of long ints. + + Changes to PgSQLTestcases.py + ---------------------------- + * 14 new tests, mostly for PgNumeric and PgResultSet. + Changes since pyPgSQL Version 2.0 ================================= |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 16:17:53
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv31301 Modified Files: Announce Log Message: 08SEP2002 gh Announcement for pyPgSQL 2.2. Index: Announce =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/Announce,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Announce 5 Jun 2002 08:49:17 -0000 1.17 --- Announce 8 Sep 2002 16:17:51 -0000 1.18 *************** *** 1,7 **** ! Announce: pyPgSQL - Version 2.1 is released. =========================================================================== ! pyPgSQL v2.1 has been released. It is a bug fix release to version 2.0, but ! also includes some enhancements. It is available at http://pypgsql.sourceforge.net. --- 1,6 ---- ! Announce: pyPgSQL - Version 2.2 is released. =========================================================================== ! pyPgSQL v2.2 has been released. It is a bug fix release to version 2.1. It is available at http://pypgsql.sourceforge.net. *************** *** 40,107 **** =========================================================================== ! Changes since pyPgSQL Version 2.0 ================================= ! pyPgSQL 2.1 is now compatible and tested to work with PostgreSQL 7.2.x. Changes to README ----------------- ! * Added documentation for the new TransactionLevel attribute of ! the Connection object. Changes to PgSQL.py ------------------- ! * Added code to implement support for setting PostgreSQL transaction ! levels. [Feature Request #481727]. ! ! * Got rid of redundant building and storing of the ! mapping of column names to column positions in the PgResultSet class. Now, ! rows of the same query are instances of a dynamically created class, which ! has this mapping as a class attribute instead of an attribute of the ! instance. This saves a lot of space, and also slightly increases ! performance of cursor fetches. ! ! * Fixed the array parsing so it also works with PostgreSQL versions 7.2.x. ! The PostgreSQL developers changed the quoting in the string representation ! of arrays in 7.2 beta cycle: strings are now only quoted when otherwise ! the array representation would be ambiguous. The new parseArray() method ! should handle the old and new way of quoting in arrays. [Bug #539769]. ! Also added a new testcase for the ARRAY type. ! ! * Improved the array parsing, so that it now passes all ! the new mean testcases. Added support for parsing multidimensional arrays. ! Eventually, the array parsing code should go as a support function into ! libpq. ! ! * Replaced all typechecks with "is" operators instead ! of equals. Mark McEahern had a problem with using pyPgSQL in combination ! with a FixedPoint class where the reason was that the FixedPoint class was ! not comarable to None. The consensus on python-list was that None and all ! types are singletons, so they should be checked using "is", which is also ! faster, because it only checks for object identity. ! ! * Fixed a couple of problems found by Steven D. Arnold: ! 1. A undefined variable was used in a few places where notices were popped ! from the notice list. ! 2. Comparisons between 2 PgNumerics gave the wrong result. ! ! * Fixed problem that occurs when the sum() aggregate returns a ! NULL. [Bug #505162]. ! ! Changes to pgversion.c ! ---------------------- ! * Allow for development and beta versions of PostgreSQL ! Changes to libpqmodule.c ! ------------------------ ! * Removed special escaping of control characters in arrays. ! * Added support for two missing OID types: aclitem and macaddr. ! * Applied patch by Chris Bainbridge [Patch #505941] "fix for null bytes in ! bytea". ! Changes to pgresult.c ! --------------------- ! * Change the point at which an OID is tested to see if it is a ! Large Object from 1700 to 16383. --- 39,82 ---- =========================================================================== ! Changes since pyPgSQL Version 2.1 ================================= ! The following source code files were added to Version 2.2 of pyPgSQL: ! ! pyPgSQL.spec - RPM spec file, contributed by Sean Reifschneider. Changes to README ----------------- ! * Added note about case-insensitiveness of column access in PgResultSet. Changes to PgSQL.py ------------------- ! * Fixed various problems with the PgResultSet: Column (attribute and ! dictionary) access is now case-insensitive. A __contains__ method was added ! and the __setattr__ method was fixed. The get method got an optional default ! value parameter. ! * Fixed various problems with the PgNumeric type: ! - Added code to allow a float as an argument to the PgNumeric constructor. ! - You can now change the precision/scale of a PgNumeric by: ! a = PgNumeric(pgnumeric, new prec, new scale). ! This can be used to 'cast' a PgNumeric to the proper precision and scale ! before storing it in a field. ! - The arithmatic routines (__add__, __radd__, etc) now ensure that the ! arguments are properly coerced to the correct types. ! - Added support for the augmented arithmetic operations (__iadd__, etc). ! - The math routines would lose precision because the precision/ scale were ! set to be the same as the first operand. This is no longer the case all ! precision is retained for the +, -, and * operations. ! * Fixed problem that occurs when a query on an OID field doesn't return any ! rows. [Bug #589370]. ! ! * Applied patch #569203 and also added __pos__ and __abs__ special methods to ! PgNumeric. ! * Ensure proper SQL-quoting of long ints. ! Changes to PgSQLTestcases.py ! ---------------------------- ! * 14 new tests, mostly for PgNumeric and PgResultSet. |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 16:17:23
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv31042 Modified Files: README Log Message: 08SEP2002 gh Added note about case-insensitiveness of column access in PgResultSet. Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** README 5 Jun 2002 08:43:36 -0000 1.24 --- README 8 Sep 2002 16:17:19 -0000 1.25 *************** *** 1,4 **** #ident "@(#) $Id$" ! pyPgSQL - v2.1: Python DB-API 2.0 Compliant Interface Module for PostgreSQL. =========================================================================== --- 1,4 ---- #ident "@(#) $Id$" ! pyPgSQL - v2.2: Python DB-API 2.0 Compliant Interface Module for PostgreSQL. =========================================================================== *************** *** 6,10 **** =============================== ! pyPgSQL, version 2.0 A Python DB-API 2.0 compliant interface for PostgreSQL Copyright 2000 by Billy G. Allie. --- 6,10 ---- =============================== ! pyPgSQL, version 2.2 A Python DB-API 2.0 compliant interface for PostgreSQL Copyright 2000 by Billy G. Allie. *************** *** 1354,1359 **** 4. The fetchone method will return a PgResultSet object instead of a sequence. A PgResultSet emulates a Python List object (for DB-API 2.0 compliance), ! but also acts as a dictionary and allows the column data to be retrieved ! by using the column name as an attribute of the PgResultSet object. [Note: This feature is controlled by the fetchReturnsList attribute of the PgSQL module.] --- 1354,1360 ---- 4. The fetchone method will return a PgResultSet object instead of a sequence. A PgResultSet emulates a Python List object (for DB-API 2.0 compliance), ! but also acts as a dictionary and allows the column data to be retrieved by ! using the column name as an attribute of the PgResultSet object. The column ! names are case-insensitive. [Note: This feature is controlled by the fetchReturnsList attribute of the PgSQL module.] |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 15:31:30
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv21140 Added Files: pyPgSQL.spec Log Message: 08SEP2002 gh Added .spec file for building RPMs. [Patch #605455] --- NEW FILE: pyPgSQL.spec --- %define name pyPgSQL %define version 2.2 %define release 1 Summary: pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL. Name: %{name} Version: %{version} Release: %{release} Source0: pypgsql-%{version}.tar.gz Copyright: BSD Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-buildroot Prefix: %{_prefix} Vendor: Billy G. Allie <bal...@so...> Url: http://pypgsql.sourceforge.net/ Requires: egenix-mx-base Requires: python2 %description pyPgSQL is a package of two modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, exports the PostgreSQL C API to Python. This module is written in C and can be compiled into Python or can be dynamically loaded on demand. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python. %prep %setup -n pypgsql %build env CFLAGS="$RPM_OPT_FLAGS" /usr/bin/python2 setup.py build %install /usr/bin/python2 setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES %clean rm -rf $RPM_BUILD_ROOT %files -f INSTALLED_FILES %doc README %defattr(-,root,root) %changelog * Sun Sep 08 2002 Gerhard Häring <ger...@gm...> - Updated to version 2.1. - Changed copyright to 'BSD' - Added README to %doc * Fri Sep 06 2002 Sean Reifschneider <jaf...@tu...> - Updated to version 2.1. - Added a description. - Added dependencies on egenix-mx-base and python2 |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 15:24:26
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv19774/test Modified Files: PgSQLTestCases.py Log Message: 08SEP2002 gh Added tests for PgResultSet. Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PgSQLTestCases.py 12 Aug 2002 03:06:36 -0000 1.21 --- PgSQLTestCases.py 8 Sep 2002 15:24:24 -0000 1.22 *************** *** 33,36 **** --- 33,37 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 08SEP2002 gh Added tests for PgResultSet. | # 11AUG2002 bga Added additional tests for the PgNumeric class. | # 03AUG2002 gh Added test for bug #589370 (wether it is possible to | *************** *** 828,838 **** self.fail(msg) def suite(): dbapi_tests = unittest.makeSuite(DBAPICompliance, "Check") moduleinterface_tests = unittest.makeSuite(PgSQLTestModuleInterface, "Check") pgsql_tests = unittest.makeSuite(PgSQLTestCases, "Check") test_suite = unittest.TestSuite((dbapi_tests, moduleinterface_tests, ! pgsql_tests)) return test_suite --- 829,966 ---- self.fail(msg) + class PgResultSetTests(unittest.TestCase): + def setUp(self): + self.cnx = PgSQL.connect(database='template1') + self.cur = self.cnx.cursor() + + def tearDown(self): + try: + self.cnx.close() + except AttributeError: + pass + except PgSQL.InterfaceError: + pass + + def getResult(self): + self.cur.execute("select 5 as id, 'Alice' as name, 29 as age") + return self.cur.fetchone() + + def CheckAttributeAccess(self): + res = self.getResult() + if not hasattr(res, "id"): + self.fail("Resultset doesn't have attribute 'id'") + if not hasattr(res, "ID"): + self.fail("Resultset doesn't have attribute 'ID'") + + def CheckAttributeValue(self): + res = self.getResult() + if res.id != 5: + self.fail("id should be 5, is %i" % res.id) + if res.ID != 5: + self.fail("ID should be 5, is %i" % res.ID) + + def CheckKeyAccess(self): + res = self.getResult() + if not "id" in res: + self.fail("Resultset doesn't have item 'id'") + if not "ID" in res: + self.fail("Resultset doesn't have item 'ID'") + + def CheckKeyValue(self): + res = self.getResult() + if res["id"] != 5: + self.fail("id should be 5, is %i" % res.id) + if res["ID"] != 5: + self.fail("ID should be 5, is %i" % res.ID) + + def CheckIndexValue(self): + res = self.getResult() + if res[0] != 5: + self.fail("item 0 should be 5, is %i" % res.id) + + def CheckChangeIndex(self): + res = self.getResult() + res[0] = 6 + if res[0] != 6: + self.fail("item 0 should be 6, is %i" % res.id) + + def CheckChangeKey(self): + res = self.getResult() + res["id"] = 6 + if res["id"] != 6: + self.fail("id should be 6, is %i" % res.id) + + res = self.getResult() + res["ID"] = 6 + if res["ID"] != 6: + self.fail("ID should be 6, is %i" % res.id) + + def CheckChangeAttr(self): + res = self.getResult() + res.id = 6 + if res.id != 6: + self.fail("id should be 6, is %i" % res.id) + + res = self.getResult() + res.ID = 6 + if res.ID != 6: + self.fail("ID should be 6, is %i" % res.id) + + def Check_haskey(self): + res = self.getResult() + if not res.has_key("id"): + self.fail("resultset should have key 'id'") + if not res.has_key("ID"): + self.fail("resultset should have key 'ID'") + if not res.has_key("Id"): + self.fail("resultset should have key 'Id'") + + def Check_len(self): + l = len(self.getResult()) + if l != 3: + self.fail("length of resultset should be 3, is %i", l) + + def Check_keys(self): + res = self.getResult() + if res.keys() != ["id", "name", "age"]: + self.fail("keys() should return %s, returns %s" % + (["id", "name", "age"], res.keys())) + + def Check_values(self): + val = self.getResult().values() + if val != [5, 'Alice', 29]: + self.fail("Wrong values(): %s" % val) + + def Check_items(self): + it = self.getResult().items() + if it != [("id", 5), ("name", 'Alice'), ("age", 29)]: + self.fail("Wrong items(): %s" % it) + + def Check_get(self): + res = self.getResult() + v = res.get("id") + if v != 5: + self.fail("Wrong result for get [1]") + + v = res.get("ID") + if v != 5: + self.fail("Wrong result for get [2]") + + v = res.get("asdf") + if v is not None: + self.fail("Wrong result for get [3]") + + v = res.get("asdf", 6) + if v != 6: + self.fail("Wrong result for get [4]") + def suite(): dbapi_tests = unittest.makeSuite(DBAPICompliance, "Check") moduleinterface_tests = unittest.makeSuite(PgSQLTestModuleInterface, "Check") pgsql_tests = unittest.makeSuite(PgSQLTestCases, "Check") + pgresultset_tests = unittest.makeSuite(PgResultSetTests, "Check") test_suite = unittest.TestSuite((dbapi_tests, moduleinterface_tests, ! pgsql_tests, pgresultset_tests)) return test_suite |
From: Gerhard H?r. <gha...@us...> - 2002-09-08 15:16:48
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv17521/pyPgSQL Modified Files: PgSQL.py Log Message: 08SEP2002 gh Fixed various problems with the PgResultSet: - Column (attribute and dictionary) access is now case- insensitive. - Added __contains__ method. - Added default value parameter to get method. - Made __setattr__ actually work. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PgSQL.py 12 Aug 2002 03:05:03 -0000 1.14 --- PgSQL.py 8 Sep 2002 15:16:45 -0000 1.15 *************** *** 30,33 **** --- 30,39 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 08SEP2002 gh Fixed various problems with the PgResultSet: | + # - Column (attribute and dictionary) access is now case- | + # insensitive. | + # - Added __contains__ method. | + # - Added default value parameter to get method. | + # - Made setattr actually work. | # 11AUG2002 bga Fixed various problems with the PgNumeric type: | # - Added code to allow a float as an argument to the | *************** *** 1622,1627 **** def __getattr__(self, key): ! if self.__class__._xlatkey.has_key(key): ! return self.baseObj[self.__class__._xlatkey[key]] raise AttributeError, key --- 1628,1634 ---- def __getattr__(self, key): ! key = key.upper() ! if self._xlatkey.has_key(key): ! return self.baseObj[self._xlatkey[key]] raise AttributeError, key *************** *** 1632,1637 **** raise AttributeError, "%s is read-only." % key ! if self.__class__._xlatkey.has_key(key): ! self.__dict__['baseObj'][self.__class__._xlatkey(key)] = value else: raise AttributeError, key --- 1639,1645 ---- raise AttributeError, "%s is read-only." % key ! key = key.upper() ! if self._xlatkey.has_key(key): ! self.__dict__['baseObj'][self._xlatkey[key]] = value else: raise AttributeError, key *************** *** 1641,1656 **** def __getitem__(self, key): ! if type(key) is StringType: ! key = self.__class__._xlatkey[key] return self.baseObj[key] def __setitem__(self, key, value): ! if type(key) is StringType: ! key = self.__class__._xlatkey[key] self.baseObj[key] = value ! return def __getslice__(self, i, j): ! klass = make_PgResultSetClass(self.__class__._desc_[i:j]) obj = klass(self.baseObj[i:j]) return obj --- 1649,1666 ---- def __getitem__(self, key): ! if isinstance(key, StringType): ! key = self._xlatkey[key.upper()] return self.baseObj[key] def __setitem__(self, key, value): ! if isinstance(key, StringType): ! key = self._xlatkey[key.upper()] self.baseObj[key] = value ! ! def __contains__(self, key): ! return self.has_key(key) def __getslice__(self, i, j): ! klass = make_PgResultSetClass(self._desc_[i:j]) obj = klass(self.baseObj[i:j]) return obj *************** *** 1684,1691 **** def has_key(self, key): ! return self.__class__._xlatkey.has_key(key) ! def get(self, key): ! return self[key] def make_PgResultSetClass(description, mapname=None): --- 1694,1704 ---- def has_key(self, key): ! return self._xlatkey.has_key(key.upper()) ! def get(self, key, defaultval=None): ! if self.has_key(key): ! return self[key] ! else: ! return defaultval def make_PgResultSetClass(description, mapname=None): *************** *** 1697,1705 **** if mapname is None: for _i in range(len(description)): ! klass.__dict__['_xlatkey'][description[_i][0]] = _i else: ! klass.__dict__['_xlatkey'].update(mapname) return klass ! #-----------------------------------------------------------------------+ --- 1710,1719 ---- if mapname is None: for _i in range(len(description)): ! klass.__dict__['_xlatkey'][description[_i][0].upper()] = _i else: ! for k, v in mapname.items(): ! klass.__dict__['_xlatkey'][k.upper()] = v return klass ! #-----------------------------------------------------------------------+ |
From: Billy G. A. <bal...@us...> - 2002-08-12 03:06:38
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv13641/test Modified Files: PgSQLTestCases.py Log Message: 11AUG2002 bga Added additional tests for the PgNumeric class. Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PgSQLTestCases.py 3 Aug 2002 06:03:40 -0000 1.20 --- PgSQLTestCases.py 12 Aug 2002 03:06:36 -0000 1.21 *************** *** 33,36 **** --- 33,37 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 11AUG2002 bga Added additional tests for the PgNumeric class. | # 03AUG2002 gh Added test for bug #589370 (wether it is possible to | # use OID in a query that doesn't return any rows). | *************** *** 273,281 **** def CheckPgNumeric(self): ! a = PgSQL.PgNumeric('4634.00') ! self.failUnless(a == 4634, 'PgNumeric comparison to Int failed.') ! self.failUnless(a == 4634.0, 'PgNumeric comparison to Float failed.') ! self.failUnless(a == 4634L, 'PgNumeric comparison to Long failed.') ! self.failUnless(a != None, 'PgNumericcomparison to None failed') class PgSQLTestCases(unittest.TestCase): --- 274,384 ---- def CheckPgNumeric(self): ! try: ! a = PgSQL.PgNumeric('1234.00') ! self.failUnless(a.getPrecision() == 6, ! 'PgNumeric from string failed') ! self.failUnless(a.getScale() == 2, 'PgNumeric from string failed') ! self.failUnless(a == 1234, 'PgNumeric comparison to string failed.') ! self.failUnless(a == 1234.0, ! 'PgNumeric comparison to Float failed.') ! self.failUnless(a == 1234L, 'PgNumeric comparison to Long failed.') ! self.failUnless(a != None, 'PgNumeric comparison to None failed') ! except StandardError, msg: ! self.fail(msg) ! ! try: ! a = PgSQL.PgNumeric(2345.00) ! self.failUnless(a.getPrecision() == 5, ! 'PgNumeric from float failed') ! self.failUnless(a.getScale() == 1, 'PgNumeric from float failed') ! self.failUnless(a == 2345, 'PgNumeric from float failed.') ! except StandardError, msg: ! self.fail(msg) ! ! try: ! a = PgSQL.PgNumeric(345600, 6, 2) ! self.failUnless(a == 3456, 'PgNumeric from int failed.') ! self.failUnless(a.getPrecision() == 6, 'PgNumeric from int failed') ! self.failUnless(a.getScale() == 2, 'PgNumeric from int failed') ! except StandardError, msg: ! self.fail(msg) ! ! try: ! a = PgSQL.PgNumeric(456700L, 6, 2) ! self.failUnless(a == 4567, 'PgNumeric from long failed.') ! self.failUnless(a.getPrecision() == 6, 'PgNumeric from long failed') ! self.failUnless(a.getScale() == 2, 'PgNumeric from long failed') ! except StandardError, msg: ! self.fail(msg) ! ! try: # Test the casting of PgNumeric -> PgNumeric to change prec/scale ! a = PgSQL.PgNumeric('123456.78') ! b = PgSQL.PgNumeric(a, 10, 4) ! c = PgSQL.PgNumeric(a, 7, 1) ! self.failUnless(b.getPrecision() == 10, 'PgNumeric cast failed') ! self.failUnless(b.getScale() == 4, 'PgNumeric cast failed') ! self.failUnless(c.getPrecision() == 7, 'PgNumeric cast failed') ! self.failUnless(c.getScale() == 1, 'PgNumeric cast failed') ! self.failUnless(a == b, 'PgNumeric cast failed') ! self.failUnless(a != c, 'PgNumeric cast failed') ! self.failUnless(str(c) == '123456.8', 'PgNumeric cast failed.') ! except StandardError, msg: ! self.fail(msg) ! ! try: # Test the basic math functions. ! a = PgSQL.PgNumeric('1234.567') ! b = PgSQL.PgNumeric('12.3456789') ! c = a + b ! self.failUnless(c.getPrecision() == 11, 'PgNumeric addition failed') ! self.failUnless(c.getScale() == 7, 'PgNumeric addition failed') ! self.failUnless(str(c) == '1246.9126789', ! 'PgNumeric addition failed.') ! c = a - b ! self.failUnless(c.getPrecision() == 11, ! 'PgNumeric subtraction failed') ! self.failUnless(c.getScale() == 7, 'PgNumeric subtraction failed') ! self.failUnless(str(c) == '1222.2213211', ! 'PgNumeric subtraction failed.') ! c = a * b ! self.failUnless(c.getPrecision() == 16, ! 'PgNumeric multiplication failed') ! self.failUnless(c.getScale() == 10, ! 'PgNumeric mulitplication failed') ! self.failUnless(str(c) == '15241.5677625363', ! 'PgNumeric multiplication failed.') ! c = a / b ! self.failUnless(c.getPrecision() == 7, 'PgNumeric division failed') ! self.failUnless(c.getScale() == 3, 'PgNumeric divisioncast failed') ! self.failUnless(str(c) == '100.000', ! 'PgNumeric divisioncast failed.') ! c = PgSQL.PgNumeric(a) ! c += b ! self.failUnless(c.getPrecision() == 11, 'PgNumeric addition failed') ! self.failUnless(c.getScale() == 7, 'PgNumeric addition failed') ! self.failUnless(str(c) == '1246.9126789', ! 'PgNumeric addition failed.') ! c = PgSQL.PgNumeric(a) ! c -= b ! self.failUnless(c.getPrecision() == 11, ! 'PgNumeric subtraction failed') ! self.failUnless(c.getScale() == 7, 'PgNumeric subtraction failed') ! self.failUnless(str(c) == '1222.2213211', ! 'PgNumeric subtraction failed.') ! c = PgSQL.PgNumeric(a) ! c *= b ! self.failUnless(c.getPrecision() == 16, ! 'PgNumeric multiplication failed') ! self.failUnless(c.getScale() == 10, ! 'PgNumeric mulitplication failed') ! self.failUnless(str(c) == '15241.5677625363', ! 'PgNumeric multiplication failed.') ! c = PgSQL.PgNumeric(a) ! c /= b ! self.failUnless(c.getPrecision() == 7, 'PgNumeric division failed') ! self.failUnless(c.getScale() == 3, 'PgNumeric divisioncast failed') ! self.failUnless(str(c) == '100.000', ! 'PgNumeric divisioncast failed.') ! except StandardError, msg: ! self.fail(msg) class PgSQLTestCases(unittest.TestCase): |
From: Billy G. A. <bal...@us...> - 2002-08-12 03:05:10
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv12330/pyPgSQL Modified Files: PgSQL.py Log Message: 11AUG2002 bga Fixed various problems with the PgNumeric type: - Added code to allow a float as an argument to the PgNumeric constructor. - You can now change the precision/scale of a PgNumeric by: a = PgNumeric(pgnumeric, new prec, new scale). This can be used to 'cast' a PgNumeric to the proper precision and scale before storing it in a field. - The arithmatic routines (__add__, __radd__, etc) now ensure that the arguments are properly coerced to the correct types. - Added support for the augmented arithmatic operations (__iadd__, etc). - The math routines would lose precision becuase the precision/ scale were set to be the same as the first operand. This is no longer the case all precision is retained for the +, -, and * operations. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PgSQL.py 3 Aug 2002 06:03:39 -0000 1.13 --- PgSQL.py 12 Aug 2002 03:05:03 -0000 1.14 *************** *** 30,33 **** --- 30,49 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 11AUG2002 bga Fixed various problems with the PgNumeric type: | + # - Added code to allow a float as an argument to the | + # PgNumeric constructor. | + # - You can now change the precision/scale of a PgNumeric | + # by: a = PgNumeric(pgnumeric, new prec, new scale). | + # This can be used to 'cast' a PgNumeric to the proper | + # precision and scale before storing it in a field. | + # - The arithmatic routines (__add__, __radd__, etc) now | + # ensure that the arguments are properly coerced to the | + # correct types. | + # - Added support for the augmented arithmatic operations | + # (__iadd__, etc). | + # - The math routines would lose precision becuase the | + # precision/scale were set to be the same as the first | + # operand. This is no longer the case all precision is | + # retained for the +, -, and * operations. | # 03AUG2002 gh Fixed problem that occurs when a query on an OID field | # doesn't return any rows. [Bug #589370]. | *************** *** 905,909 **** class PgNumeric: def __init__(self, value, prec=None, scale=None): ! if type(value) is LongType or type(value) is IntType or value is None: if prec is None or scale is None: raise TypeError, \ --- 921,925 ---- class PgNumeric: def __init__(self, value, prec=None, scale=None): ! if type(value) in [IntType, LongType] or value is None: if prec is None or scale is None: raise TypeError, \ *************** *** 916,980 **** self.__p = prec self.__s = scale ! return ! ! if type(value) is not StringType: ! raise TypeError, "value must be a string." ! ! _v = value.split() ! if len(_v) == 0 or len(_v) > 1: ! raise ValueError, \ ! "invalid literal for PgNumeric: %s" % value ! _v = _v[0] ! ! # At this point _v is value with leading and trailing blanks ! # removed. Initalize the precision and scale values. They will be ! # determined from the input string (value) is prec and scale are ! # None. ! ! _vs = value.rfind('.') # Get the location of the decimal point. ! # It's used to determine the precision and ! if prec: # scale if they aren't passed in, and to ! self.__p = prec # adjust the input string to match the passed ! else: # in scale. ! self.__p = len(value) ! if _vs >= 0: ! self.__p = self.__p - 1 ! # Calculate the scale of the passed in string. _vs will contain the ! # calulated scale. ! if _vs >= 0: ! _vs = len(value) - _vs - 1 ! else: ! _vs = 0 ! if scale: ! self.__s = scale ! else: ! self.__s = _vs ! # Calculate the number of character to add/remove from the end of ! # the input string in order to have it match the given scale. _sd ! # will contain the number of characters to add (>0) or remove (<0). ! _sd = self.__s - _vs ! if _sd == 0: ! pass # No change to value needed. ! elif _sd > 0: ! _v = _v + ('0' * _sd) # Add needed zeros to the end of value ! else: ! _v = _v[:_sd] # Remove excess digits from the end. ! if self.__s: ! _s = _v[:-(self.__s + 1)] + _v[-self.__s:] ! else: ! _s = _v ! try: ! self.__v = long(_s) ! except: ! raise ValueError, \ ! "invalid literal for PgNumeric: %s" % value def __fmtNumeric(self, value=None): --- 932,1043 ---- self.__p = prec self.__s = scale ! elif type(value) is FloatType: ! _s = repr(value) ! _d = _s.rfind('.') ! _e = _s.rfind('e') ! _exp = 0 ! if (_e >= 0): ! _exp = int(_s[_e+1:]) ! _s = _s[:_e] ! if _exp > 31: ! raise OverflowError, "float too large for PgNumeric" ! if _exp < -31: ! raise OverflowError, "float too small for PgNumeric" ! _s = _s[:_d] + _s[_d+1:] ! if _exp == 0: ! _sc = len(_s) - _d ! elif _exp > 0: ! _s = _s + ("0" * (_exp - len(_s) + 1)) ! _sc = 0 ! else: ! _sc = -_exp + len(_s) - 1 ! self.__v = long(_s) ! self.__p = len(_s) ! if self.__p < _sc: ! self.__p = _sc ! self.__s = _sc ! elif type(value) is StringType: ! _v = value.split() ! if len(_v) == 0 or len(_v) > 1: ! raise ValueError, \ ! "invalid literal for PgNumeric: %s" % value ! _v = _v[0] ! # At this point _v is value with leading and trailing blanks ! # removed. Initalize the precision and scale values. They will be ! # determined from the input string (value) is prec and scale are ! # None. ! _vs = value.rfind('.') # Get the location of the decimal point. ! # It's used to determine the precision and ! if prec: # scale if they aren't passed in, and to ! self.__p = prec # adjust the input string to match the ! else: # passed in scale. ! self.__p = len(value) ! if _vs >= 0: ! self.__p = self.__p - 1 ! # Calculate the scale of the passed in string. _vs will contain the ! # calulated scale. ! if _vs >= 0: ! _vs = len(value) - _vs - 1 ! else: ! _vs = 0 ! ! if scale: ! self.__s = scale ! else: ! self.__s = _vs ! # Calculate the number of character to add/remove from the end of ! # the input string in order to have it match the given scale. _sd ! # will contain the number of characters to add (>0) or remove (<0). ! _sd = self.__s - _vs ! if _sd == 0: ! pass # No change to value needed. ! elif _sd > 0: ! _v = _v + ('0' * _sd) # Add needed zeros to the end of value ! else: ! _v = _v[:_sd] # Remove excess digits from the end. ! if self.__s: ! _s = _v[:-(self.__s + 1)] + _v[-self.__s:] ! else: ! _s = _v ! ! try: ! self.__v = long(_s) ! except: ! raise ValueError, \ ! "invalid literal for PgNumeric: %s" % value ! elif isinstance(value, PgNumeric): ! # This is used to "cast" a PgNumeric to the specified precision ! # and scale. It can also make a copy of a PgNumeric. ! self.__v = value.__v ! if scale: ! self.__s = scale ! _ds = scale - value.__s ! else: ! self.__s = value.__s ! _ds = 0 ! if prec: ! self.__p = prec ! else: ! self.__p = value.__p ! # Now we adjust the value to reflect the new scaling factor. ! if _ds > 0: ! if _ds == 1: ! self.__v = self.__v * 10 ! else: ! self.__v = self.__v * (10L ** _ds) ! elif _ds < 0: ! self.__v = self._round(self.__v, abs(_ds)) ! if self.__v > (10L ** self.__p): ! raise OverflowError, "result exceeds precision of %d" % self.__p ! else: ! raise TypeError, "value can not be converted to a PgNumeric." def __fmtNumeric(self, value=None): *************** *** 1013,1053 **** def __coerce__(self, other): ! _s = None ! if type(other) in [IntType, LongType]: ! _s = str(other) ! elif type(other) is FloatType: ! _s = str(long(((other * (10.0 ** self.__s)) + 0.5))) ! elif type(other) == type(self): ! return (self, other) ! else: ! _s = None ! ! if _s: if _s[-1:] == 'L': _s = _s[:-1] # Work around v1.5/1.6 differences ! _s = "%s.%s" % (_s, ("0" * self.__s)) ! if len(_s) > self.__p: ! return None ! else: ! return (self, PgNumeric(_s, self.__p, self.__s)) ! ! return None def _round(self, value, drop): ! if drop > 0: return (((value / (10L ** (drop - 1))) + 5L) / 10L) return value def __mul__(self, other): ! _p = self._round((self.__v * other.__v), other.__s ) ! return PgNumeric(_p, self.__p, self.__s) ! def __rmul__(other, self): ! _p = self._round((self.__v * other.__v), other.__s ) ! return PgNumeric(_p, self.__p, self.__s) def __div__(self, other): _n = (self.__v * (10L ** (other.__s + 1))) _d = other.__v --- 1076,1218 ---- def __coerce__(self, other): ! if isinstance(other, PgNumeric): ! return self, other ! elif type(other) in [IntType, LongType]: ! _s = str(other) if _s[-1:] == 'L': _s = _s[:-1] # Work around v1.5/1.6 differences ! return (self, PgNumeric(_s)) ! elif type(other) == FloatType: ! return (self, PgNumeric(other)) ! return None def _round(self, value, drop): ! if drop == 1: ! return ((value + 5L) / 10L) ! elif drop > 1: return (((value / (10L ** (drop - 1))) + 5L) / 10L) return value + def __add__(self, other): + _c = self.__coerce__(other) + if _c is None: + return None + self, other = _c + if self.__s < other.__s: + _sc = other.__s + _ds = other.__s - self.__s + _s = self.__v * (10L ** _ds) + _o = other.__v + elif self.__s > other.__s: + _sc = self.__s + _ds = self.__s - other.__s + _s = self.__v + _o = other.__v * (10L ** _ds) + else: + _sc = self.__s + _s = self.__v + _o = other.__v + if (self.__p - self.__s) >= (other.__p - other.__s): + _pr = self.__p - self.__s + _sc + else: + _pr = other.__p - other.__s + sc + + return PgNumeric((_s + _o), _pr, _sc) + + def __radd__(self, other): + return __add__(self, other) + + def __iadd__(self, other): + _r = self.__add__(other) + if _r is None: + return None + self.__v = _r.__v + self.__p = _r.__p + self.__s = _r.__s + return self + + def __sub__(self, other): + _c = self.__coerce__(other) + if _c is None: + return None + self, other = _c + if self.__s < other.__s: + _sc = other.__s + _ds = other.__s - self.__s + _s = self.__v * (10L ** _ds) + _o = other.__v + elif self.__s > other.__s: + _sc = self.__s + _ds = self.__s - other.__s + _s = self.__v + _o = other.__v * (10L ** _ds) + else: + _sc = self.__s + _s = self.__v + _o = other.__v + if (self.__p - self.__s) >= (other.__p - other.__s): + _pr = self.__p - self.__s + _sc + else: + _pr = other.__p - other.__s + sc + + return PgNumeric((_s - _o), _pr, _sc) + + def __rsub__(self, other): + if self.__s < other.__s: + _sc = other.__s + _ds = other.__s - self.__s + _s = self.__v * (10L ** _ds) + _o = other.__v + elif self.__s > other.__s: + _sc = self.__s + _ds = self.__s - other.__s + _s = self.__v + _o = other.__v * (10L ** _ds) + else: + _sc = self.__s + _s = self.__v + _o = other.__v + if (self.__p - self.__s) >= (other.__p - other.__s): + _pr = self.__p - self.__s + _sc + else: + _pr = other.__p - other.__s + sc + + return PgNumeric((_o - _s), _pr, _sc) + + def __isub__(self, other): + _r = self.__sub__(other) + if _r is None: + return None + self.__v = _r.__v + self.__p = _r.__p + self.__s = _r.__s + return self + def __mul__(self, other): ! _c = self.__coerce__(other) ! if _c is None: ! return None ! self, other = _c ! _p = self.__v * other.__v ! return PgNumeric(_p, self.__p + other.__p, self.__s + other.__s) ! def __rmul__(self, other): ! return self.__mul__(self, other) + def __imul__(self, other): + _r = self.__mul__(other) + if _r is None: + return None + self.__v = _r.__v + self.__p = _r.__p + self.__s = _r.__s + return self def __div__(self, other): + _c = self.__coerce__(other) + if _c is None: + return None + self, other = _c _n = (self.__v * (10L ** (other.__s + 1))) _d = other.__v *************** *** 1055,1065 **** return PgNumeric(self._round(_q, 1), self.__p, self.__s) ! def __rdiv__(other, self): ! _n = (self.__v * (10L ** (other.__s + 1))) ! _d = other.__v _q = (_n / _d) ! return PgNumeric(self._round(_q, 1), self.__p, self.__s) def __cmp__(self, other): if self.__s < other.__s: _d = other.__s - self.__s --- 1220,1249 ---- return PgNumeric(self._round(_q, 1), self.__p, self.__s) ! def __rdiv__(self, other): ! _c = self.__coerce__(other) ! if _c is None: ! return None ! self, other = _c ! _n = (other.__v * (10L ** (self.__s + 1))) ! _d = self.__v _q = (_n / _d) ! return PgNumeric(self._round(_q, 1), other.__p, other.__s) ! ! def __idiv__(self, other): ! _r = self.__div__(other) ! if _r is None: ! return None ! self.__v = _r.__v ! self.__p = _r.__p ! self.__s = _r.__s ! return self def __cmp__(self, other): + if other == None: + return 1 + _c = self.__coerce__(other) + if _c is None: + return None + self, other = _c if self.__s < other.__s: _d = other.__s - self.__s *************** *** 1089,1120 **** else: return -self - - def __add__(self, other): - if self.__s < other.__s: - _d = other.__s - self.__s - _s = self._round(((self.__v * (10L ** _d)) + other.__v), _d) - elif self.__s > other.__s: - _d = self.__s - other.__s - _s = self._round((self.__v + (other.__v * (10L ** _d))), _d) - else: - _s = self.__v + other.__v - return PgNumeric(_s, self.__p, self.__s) - - def __radd__(self, other): - return __add__(other, self) - - def __sub__(self, other): - if self.__s < other.__s: - _d = other.__s - self.__s - _s = self._round(((self.__v * (10L ** _d)) - other.__v), _d) - elif self.__s > other.__s: - _d = self.__s - other.__s - _s = self._round((self.__v - (other.__v * (10L ** _d))), _d) - else: - _s = self.__v - other.__v - return PgNumeric(_s, self.__p, self.__s) - - def __rsub__(self, other): - return __sub__(other, self) def _quote(self, forArray=0): --- 1273,1276 ---- |
From: Gerhard H?r. <gha...@us...> - 2002-08-03 06:03:43
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv22828/test Modified Files: PgSQLTestCases.py Log Message: 03AUG2002 gh - Fixed problem that occurs when a query on an OID field doesn't return any rows. [Bug #589370]. - Added the corresponding test case. Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PgSQLTestCases.py 29 Jul 2002 00:59:59 -0000 1.19 --- PgSQLTestCases.py 3 Aug 2002 06:03:40 -0000 1.20 *************** *** 33,36 **** --- 33,38 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 03AUG2002 gh Added test for bug #589370 (wether it is possible to | + # use OID in a query that doesn't return any rows). | # 29JUL2002 gh Added a few tests for PgNumeric (which currently fail). | # Simplified the construction of testcases by a lot and | *************** *** 715,718 **** --- 717,727 ---- except StandardError, msg: self.fail(msg) + + def CheckSelectOfOidWithZeroRows(self): + # Check for control flow of bug #589370 + try: + self.cur.execute('select oid from pg_type where false') + except StandardError, msg: + self.fail(msg) def suite(): |
From: Gerhard H?r. <gha...@us...> - 2002-08-03 06:03:43
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv22828/pyPgSQL Modified Files: PgSQL.py Log Message: 03AUG2002 gh - Fixed problem that occurs when a query on an OID field doesn't return any rows. [Bug #589370]. - Added the corresponding test case. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PgSQL.py 29 Jul 2002 01:00:44 -0000 1.12 --- PgSQL.py 3 Aug 2002 06:03:39 -0000 1.13 *************** *** 30,33 **** --- 30,35 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 03AUG2002 gh Fixed problem that occurs when a query on an OID field | + # doesn't return any rows. [Bug #589370]. | # 29JUL2002 gh Applied patch #569203 and also added __pos__ and | # __abs__ special methods to PgNumeric. | *************** *** 2160,2168 **** _typ = _bt elif _typ.value == PG_OID: ! _p = _res.getvalue(0, _i) ! if type(_p) in [PgLargeObjectType, NoneType]: _typ = PgTypes(PG_BLOB) else: ! _typ = PgTypes(PG_ROWID) _j.append(_typ) --- 2162,2175 ---- _typ = _bt elif _typ.value == PG_OID: ! try: ! _p = _res.getvalue(0, _i) ! except (ValueError, TypeError), m: ! # We can only guess here ... _typ = PgTypes(PG_BLOB) else: ! if type(_p) in [PgLargeObjectType, NoneType]: ! _typ = PgTypes(PG_BLOB) ! else: ! _typ = PgTypes(PG_ROWID) _j.append(_typ) |
From: Gerhard H?r. <gha...@us...> - 2002-07-29 01:00:47
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv475/pyPgSQL Modified Files: PgSQL.py Log Message: 29JUL2002 gh Applied patch #569203 and also added __pos__ and __abs__ special methods to PgNumeric. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PgSQL.py 1 Jul 2002 02:09:05 -0000 1.11 --- PgSQL.py 29 Jul 2002 01:00:44 -0000 1.12 *************** *** 30,33 **** --- 30,35 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 29JUL2002 gh Applied patch #569203 and also added __pos__ and | + # __abs__ special methods to PgNumeric. | # 15MAY2002 gh Got rid of redundant building and storing of the | # mapping of column names to column positions in the | *************** *** 1070,1073 **** --- 1072,1090 ---- _o = other.__v return cmp(_s, _o) + + def __neg__(self): + return PgNumeric(-self.__v, self.__p, self.__s) + + def __nonzero__(self): + return self.__v not in (None, 0) + + def __pos__(self): + return self + + def __abs__(self): + if self.__v >= 0: + return self + else: + return -self def __add__(self, other): |
From: Gerhard H?r. <gha...@us...> - 2002-07-29 01:00:06
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv32641/test Modified Files: PgSQLTestCases.py Log Message: 29JUL2002 gh Added a few tests for PgNumeric (which currently fail). Simplified the construction of testcases by a lot and fixed a bug where there were two methods named CheckConnectionObject (thus hiding the first one). Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PgSQLTestCases.py 1 Jul 2002 02:09:05 -0000 1.18 --- PgSQLTestCases.py 29 Jul 2002 00:59:59 -0000 1.19 *************** *** 33,36 **** --- 33,40 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 29JUL2002 gh Added a few tests for PgNumeric (which currently fail). | + # Simplified the construction of testcases by a lot and | + # fixed a bug where there were two methods named | + # CheckConnectionObject (thus hiding the first one). | # 16APR2002 gh Updated the PostgreSQL version specific tests to cope | # with PostgreSQL 7.2.x. | *************** *** 266,269 **** --- 270,280 ---- 'PgMoney __neg__ operation failed.') + def CheckPgNumeric(self): + a = PgSQL.PgNumeric('4634.00') + self.failUnless(a == 4634, 'PgNumeric comparison to Int failed.') + self.failUnless(a == 4634.0, 'PgNumeric comparison to Float failed.') + self.failUnless(a == 4634L, 'PgNumeric comparison to Long failed.') + self.failUnless(a != None, 'PgNumericcomparison to None failed') + class PgSQLTestCases(unittest.TestCase): def setUp(self): *************** *** 283,288 **** self.assert_(isinstance(self.cnx, PgSQL.Connection), 'PgSQL.connect did not return a Connection object') - - def CheckConnectionObject(self): self.assert_(self.cnx.autocommit == 0, 'autocommit default is not zero (0)') --- 294,297 ---- *************** *** 662,666 **** "res should be None at this point, but it isn't.") ! def MoreResultObjectChecks(self): # Define the row counts for various version of PosrtgreSQL # Note: We only have to check for the minor version number in order --- 671,675 ---- "res should be None at this point, but it isn't.") ! def CheckDoMoreResultObjectChecks(self): # Define the row counts for various version of PosrtgreSQL # Note: We only have to check for the minor version number in order *************** *** 707,772 **** self.fail(msg) ! def main(): ! TestSuite = unittest.TestSuite() ! TestSuite.addTest(DBAPICompliance("CheckAPILevel")) ! TestSuite.addTest(DBAPICompliance("CheckThreadSafety")) ! TestSuite.addTest(DBAPICompliance("CheckParamStyle")) ! TestSuite.addTest(DBAPICompliance("CheckWarning")) ! TestSuite.addTest(DBAPICompliance("CheckError")) ! TestSuite.addTest(DBAPICompliance("CheckInterfaceError")) ! TestSuite.addTest(DBAPICompliance("CheckDatabaseError")) ! TestSuite.addTest(DBAPICompliance("CheckDataError")) ! TestSuite.addTest(DBAPICompliance("CheckOperationalError")) ! TestSuite.addTest(DBAPICompliance("CheckIntegrityError")) ! TestSuite.addTest(DBAPICompliance("CheckInternalError")) ! TestSuite.addTest(DBAPICompliance("CheckProgrammingError")) ! TestSuite.addTest(DBAPICompliance("CheckNotSupportedError")) ! ! TestSuite.addTest(PgSQLTestModuleInterface("CheckFetchReturnsList")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckBooleanConstructors")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckPgInt8")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckPgInt2")) ! TestSuite.addTest(PgSQLTestModuleInterface("CheckPgMoney")) ! ! TestSuite.addTest(PgSQLTestCases("CheckConnectionObject")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionObject")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionObject")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionClose")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionCommit")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionRollback")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionCursor")) ! TestSuite.addTest(PgSQLTestCases("CheckConnectionBinary")) ! TestSuite.addTest(PgSQLTestCases("CheckCloseConnection")) ! if version >= 20100: ! TestSuite.addTest(PgSQLTestCases("CheckWeakReference1")) ! TestSuite.addTest(PgSQLTestCases("CheckWeakReference2")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorObject")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorArraysize")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorDescription")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorRowcount")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorCallproc")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorClose")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorExecute")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorExecutemany")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorFetchone")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorFetchMany")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorFetchall")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorSetoutputsize")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorSetinputsizes")) ! TestSuite.addTest(PgSQLTestCases("CheckCursorNextset")) ! TestSuite.addTest(PgSQLTestCases("CheckPgVer")) ! TestSuite.addTest(PgSQLTestCases("CheckExecuteWithSingleton")) ! TestSuite.addTest(PgSQLTestCases("CheckExecuteWithTuple")) ! TestSuite.addTest(PgSQLTestCases("CheckExecuteWithDictionary")) ! TestSuite.addTest(PgSQLTestCases("CheckResultObject")) ! TestSuite.addTest(PgSQLTestCases("CheckResultFetchone")) ! TestSuite.addTest(PgSQLTestCases("MoreResultObjectChecks")) ! TestSuite.addTest(PgSQLTestCases("CheckSelectOfNonPrintableString")) runner = unittest.TextTestRunner() ! runner.run(TestSuite) if __name__ == "__main__": main() - --- 716,732 ---- self.fail(msg) ! def suite(): ! dbapi_tests = unittest.makeSuite(DBAPICompliance, "Check") ! moduleinterface_tests = unittest.makeSuite(PgSQLTestModuleInterface, "Check") ! pgsql_tests = unittest.makeSuite(PgSQLTestCases, "Check") ! test_suite = unittest.TestSuite((dbapi_tests, moduleinterface_tests, ! pgsql_tests)) ! return test_suite + def main(): runner = unittest.TextTestRunner() ! runner.run(suite()) if __name__ == "__main__": main() |
From: Gerhard H?r. <gha...@us...> - 2002-07-01 02:09:08
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv19197/pyPgSQL Modified Files: PgSQL.py Log Message: 01JUL2002 gh Ensure proper SQL-quoting of long ints. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PgSQL.py 15 May 2002 16:24:18 -0000 1.10 --- PgSQL.py 1 Jul 2002 02:09:05 -0000 1.11 *************** *** 1644,1647 **** --- 1644,1650 ---- return PgQuoteString(value) + if type(value) is LongType: + return str(value) + return repr(value) |
From: Gerhard H?r. <gha...@us...> - 2002-07-01 02:09:08
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv19197/test Modified Files: PgSQLTestCases.py Log Message: 01JUL2002 gh Ensure proper SQL-quoting of long ints. Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PgSQLTestCases.py 16 Apr 2002 00:14:01 -0000 1.17 --- PgSQLTestCases.py 1 Jul 2002 02:09:05 -0000 1.18 *************** *** 697,700 **** --- 697,710 ---- self.fail(msg) + def CheckSelectOfLong(self): + try: + self.cur.execute('select %s + %s as a', (5L, 6L)) + r = self.cur.fetchone() + self.assertEqual(r.a, 11, + "Sum of 5 and 6 should have been 11, was %i" + % r.a) + except StandardError, msg: + self.fail(msg) + def main(): TestSuite = unittest.TestSuite() |
From: Gerhard H?r. <gha...@us...> - 2002-06-05 09:17:38
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv16621 Modified Files: pgversion.c Log Message: 05JUN2002 gh Fix name clash with stricmp with gcc on win32. Index: pgversion.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgversion.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pgversion.c 16 Apr 2002 00:14:01 -0000 1.15 --- pgversion.c 5 Jun 2002 09:17:35 -0000 1.16 *************** *** 111,118 **** /***********************************************************************\ ! | Name: stricmp | ! | Synopsis: int stricmp(char *s1, char *s2); | ! | Description: stricmp compares its arguments (ignoring case) and re- | ! | turns an integer less than, equal to, or greater than | | 0, based upon whether s1 is lexicographically less | | than, equal to, or greater than s2. | --- 111,118 ---- /***********************************************************************\ ! | Name: pgstricmp | ! | Synopsis: int pgstricmp(char *s1, char *s2); | ! | Description: pgstricmp compares its arguments (ignoring case) and | ! | returns an integer less than, equal to, or greater than | | 0, based upon whether s1 is lexicographically less | | than, equal to, or greater than s2. | *************** *** 121,125 **** \***********************************************************************/ ! static int stricmp(char *s1, char *s2) { int c1, c2; --- 121,125 ---- \***********************************************************************/ ! static int pgstricmp(char *s1, char *s2) { int c1, c2; *************** *** 175,179 **** /* Allow for development versions */ ! if (stricmp(last, "devel") == 0) return (errno != 0); --- 175,179 ---- /* Allow for development versions */ ! if (pgstricmp(last, "devel") == 0) return (errno != 0); |