mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-04-29 04:33:41 +03:00
Small changes to interval parsing.
This commit is contained in:
parent
f03b94d84b
commit
c5bc1a3b9a
|
@ -1,6 +1,11 @@
|
||||||
|
2005-11-04 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
|
* 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>
|
2005-11-03 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
* Applied patch from Daniele Varazzo to enablÃeDecimal on Python
|
* Applied patch from Daniele Varazzo to enable Decimal on Python
|
||||||
2.3 when the module is available (run-time check, nice.)
|
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>
|
||||||
|
|
|
@ -38,6 +38,15 @@ skip_until_space(char *s)
|
||||||
return 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 casting objects **/
|
||||||
#include "psycopg/typecast_basic.c"
|
#include "psycopg/typecast_basic.c"
|
||||||
|
|
|
@ -172,7 +172,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
||||||
|
|
||||||
Dprintf("typecast_PYINTERVAL_cast: s = %s", str);
|
Dprintf("typecast_PYINTERVAL_cast: s = %s", str);
|
||||||
|
|
||||||
while (*str) {
|
while (len-- > 0 && *str) {
|
||||||
switch (*str) {
|
switch (*str) {
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
|
@ -190,7 +190,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
||||||
case 'y':
|
case 'y':
|
||||||
if (part == 0) {
|
if (part == 0) {
|
||||||
years = (long)(v*sign);
|
years = (long)(v*sign);
|
||||||
str = skip_until_space(str);
|
str = skip_until_space2(str, &len);
|
||||||
v = 0.0; sign = 1.0; part = 1;
|
v = 0.0; sign = 1.0; part = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -198,7 +198,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
||||||
case 'm':
|
case 'm':
|
||||||
if (part <= 1) {
|
if (part <= 1) {
|
||||||
months = (long)(v*sign);
|
months = (long)(v*sign);
|
||||||
str = skip_until_space(str);
|
str = skip_until_space2(str, &len);
|
||||||
v = 0.0; sign = 1.0; part = 2;
|
v = 0.0; sign = 1.0; part = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -206,7 +206,7 @@ typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
|
||||||
case 'd':
|
case 'd':
|
||||||
if (part <= 2) {
|
if (part <= 2) {
|
||||||
days = (long)(v*sign);
|
days = (long)(v*sign);
|
||||||
str = skip_until_space(str);
|
str = skip_until_space2(str, &len);
|
||||||
v = 0.0; sign = 1.0; part = 3;
|
v = 0.0; sign = 1.0; part = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7,8 +7,8 @@ define=PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3
|
||||||
use_pydatetime=1
|
use_pydatetime=1
|
||||||
|
|
||||||
# Set to 1 if you want to enable "Decimal" type on python 2.3.
|
# 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,
|
# If the "decimal" module is found in the PYTHONPATH it will be used, else
|
||||||
# else fall back on the float type.
|
# fall back on the float type.
|
||||||
use_decimal=0
|
use_decimal=0
|
||||||
|
|
||||||
# "include_dirs" is the preferred method for locating postgresql headers,
|
# "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.sysconfig import get_python_inc
|
||||||
from distutils.ccompiler import get_default_compiler
|
from distutils.ccompiler import get_default_compiler
|
||||||
|
|
||||||
PSYCOPG_VERSION = '2.0b5'
|
PSYCOPG_VERSION = '2.0b6'
|
||||||
version_flags = []
|
version_flags = []
|
||||||
|
|
||||||
# to work around older distutil limitations
|
# to work around older distutil limitations
|
||||||
|
|
Loading…
Reference in New Issue
Block a user