mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 18:33:44 +03:00
Small changes to interval parsing.
This commit is contained in:
parent
f03b94d84b
commit
c5bc1a3b9a
11
ChangeLog
11
ChangeLog
|
@ -1,9 +1,14 @@
|
|||
2005-11-03 Federico Di Gregorio <fog@initd.org>
|
||||
2005-11-04 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* Applied patch from Daniele Varazzo to enablÃeDecimal on Python
|
||||
* psycopg/typecast_datetime.c: now typecast_PYINTERVAL_cast limit the
|
||||
scan to 'len' characters in the string (should fix #65.)
|
||||
|
||||
2005-11-03 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* Applied patch from Daniele Varazzo to enable Decimal on Python
|
||||
2.3 when the module is available (run-time check, nice.)
|
||||
|
||||
2005-10-26 Federico Di Gregorio <fog@initd.org>
|
||||
2005-10-26 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* setup.cfg: added include_dirs line for SUSE 9.3.
|
||||
|
||||
|
|
|
@ -38,6 +38,15 @@ skip_until_space(char *s)
|
|||
return s;
|
||||
}
|
||||
|
||||
static char *
|
||||
skip_until_space2(char *s, int *len)
|
||||
{
|
||||
while (*len > 0 && *s && *s != ' ') {
|
||||
s++; (*len)--;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/** include casting objects **/
|
||||
#include "psycopg/typecast_basic.c"
|
||||
|
|
|
@ -89,7 +89,7 @@ typecast_PYDATETIME_cast(char *str, int len, PyObject *curs)
|
|||
}
|
||||
|
||||
else {
|
||||
Dprintf("typecast_PYDATETIME_cast: s = %s", str);
|
||||
Dprintf("typecast_PYDATETIME_cast: s = %s", str);
|
||||
n = sscanf(str, "%d-%d-%d %d:%d:%lf%c%d:%d",
|
||||
&y, &m, &d, &hh, &mm, &ss, &tzs, &tzh, &tzm);
|
||||
Dprintf("typecast_PYDATETIME_cast: date parsed, %d components", n);
|
||||
|
@ -172,7 +172,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
|||
|
||||
Dprintf("typecast_PYINTERVAL_cast: s = %s", str);
|
||||
|
||||
while (*str) {
|
||||
while (len-- > 0 && *str) {
|
||||
switch (*str) {
|
||||
|
||||
case '-':
|
||||
|
@ -190,7 +190,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
|||
case 'y':
|
||||
if (part == 0) {
|
||||
years = (long)(v*sign);
|
||||
str = skip_until_space(str);
|
||||
str = skip_until_space2(str, &len);
|
||||
v = 0.0; sign = 1.0; part = 1;
|
||||
}
|
||||
break;
|
||||
|
@ -198,7 +198,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
|||
case 'm':
|
||||
if (part <= 1) {
|
||||
months = (long)(v*sign);
|
||||
str = skip_until_space(str);
|
||||
str = skip_until_space2(str, &len);
|
||||
v = 0.0; sign = 1.0; part = 2;
|
||||
}
|
||||
break;
|
||||
|
@ -206,7 +206,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
|||
case 'd':
|
||||
if (part <= 2) {
|
||||
days = (long)(v*sign);
|
||||
str = skip_until_space(str);
|
||||
str = skip_until_space2(str, &len);
|
||||
v = 0.0; sign = 1.0; part = 3;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -7,8 +7,8 @@ define=PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3
|
|||
use_pydatetime=1
|
||||
|
||||
# Set to 1 if you want to enable "Decimal" type on python 2.3.
|
||||
# If the "decimal" module is found in the PYTHONPATH it will be used,
|
||||
# else fall back on the float type.
|
||||
# If the "decimal" module is found in the PYTHONPATH it will be used, else
|
||||
# fall back on the float type.
|
||||
use_decimal=0
|
||||
|
||||
# "include_dirs" is the preferred method for locating postgresql headers,
|
||||
|
|
2
setup.py
2
setup.py
|
@ -55,7 +55,7 @@ from distutils.command.build_ext import build_ext
|
|||
from distutils.sysconfig import get_python_inc
|
||||
from distutils.ccompiler import get_default_compiler
|
||||
|
||||
PSYCOPG_VERSION = '2.0b5'
|
||||
PSYCOPG_VERSION = '2.0b6'
|
||||
version_flags = []
|
||||
|
||||
# to work around older distutil limitations
|
||||
|
|
Loading…
Reference in New Issue
Block a user