Code cleanup.

This commit is contained in:
Federico Di Gregorio 2005-10-18 01:29:47 +00:00
parent a1ed1fb267
commit 6b0b634bae
20 changed files with 95 additions and 80 deletions

View File

@ -1,5 +1,9 @@
2005-10-18 Federico Di Gregorio <fog@initd.org> 2005-10-18 Federico Di Gregorio <fog@initd.org>
* Big cleanup of unsigned chars to tame gcc 4.
* Big cleanup of module names (i.e., psycopg2._psycopg everywhere.)
* psycopg/config.h: added fake localtime_r for platforms missing it * psycopg/config.h: added fake localtime_r for platforms missing it
* psycopg/cursor_type.c: cursors now have a FixedOffsetTimezone * psycopg/cursor_type.c: cursors now have a FixedOffsetTimezone

7
NEWS
View File

@ -13,7 +13,12 @@ What's new in psycopg 2.0 rc 1
* Better docstrings for a few functions/methods. * Better docstrings for a few functions/methods.
* Some time-related functions like psycopg2.TimeFromTicks() now take the * Some time-related functions like psycopg2.TimeFromTicks() now take the
local timezone into account. local timezone into account. Also a tzinfo object (as per datetime module
specifications) can be passed to the psycopg2.Time and psycopg2.Datetime
constructors.
* All classes have been renamed to exist in the psycopg2._psycopg module,
to fix problems with automatic documentation generators like epydoc.
What's new in psycopg 2.0 beta 4 What's new in psycopg 2.0 beta 4
-------------------------------- --------------------------------

View File

@ -140,19 +140,19 @@ asis_del(PyObject* self)
static PyObject * static PyObject *
asis_repr(asisObject *self) asis_repr(asisObject *self)
{ {
return PyString_FromFormat("<psycopg.AsIs object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.AsIs object at %p>", self);
} }
/* object type */ /* object type */
#define asisType_doc \ #define asisType_doc \
"psycopg.AsIs(str) -> new AsIs adapter object" "AsIs(str) -> new AsIs adapter object"
PyTypeObject asisType = { PyTypeObject asisType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.AsIs", "psycopg2._psycopg.AsIs",
sizeof(asisObject), sizeof(asisObject),
0, 0,
asis_dealloc, /*tp_dealloc*/ asis_dealloc, /*tp_dealloc*/

View File

@ -257,18 +257,18 @@ binary_del(PyObject* self)
static PyObject * static PyObject *
binary_repr(binaryObject *self) binary_repr(binaryObject *self)
{ {
return PyString_FromFormat("<psycopg.Binary object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.Binary object at %p>", self);
} }
/* object type */ /* object type */
#define binaryType_doc \ #define binaryType_doc \
"psycopg.Binary(buffer) -> new binary object" "Binary(buffer) -> new binary object"
PyTypeObject binaryType = { PyTypeObject binaryType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.Binary", "psycopg2._psycopg.Binary",
sizeof(binaryObject), sizeof(binaryObject),
0, 0,
binary_dealloc, /*tp_dealloc*/ binary_dealloc, /*tp_dealloc*/

View File

@ -178,18 +178,19 @@ pydatetime_del(PyObject* self)
static PyObject * static PyObject *
pydatetime_repr(pydatetimeObject *self) pydatetime_repr(pydatetimeObject *self)
{ {
return PyString_FromFormat("<psycopg.datetime object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.datetime object at %p>",
self);
} }
/* object type */ /* object type */
#define pydatetimeType_doc \ #define pydatetimeType_doc \
"psycopg.Pydatetime(datetime, type) -> new datetime wrapper object" "datetime(datetime, type) -> new datetime wrapper object"
PyTypeObject pydatetimeType = { PyTypeObject pydatetimeType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.datetime", "psycopg2._psycopg.datetime",
sizeof(pydatetimeObject), sizeof(pydatetimeObject),
0, 0,
pydatetime_dealloc, /*tp_dealloc*/ pydatetime_dealloc, /*tp_dealloc*/

View File

@ -212,18 +212,18 @@ list_del(PyObject* self)
static PyObject * static PyObject *
list_repr(listObject *self) list_repr(listObject *self)
{ {
return PyString_FromFormat("<psycopg.list object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.List object at %p>", self);
} }
/* object type */ /* object type */
#define listType_doc \ #define listType_doc \
"psycopg.List(list) -> new list wrapper object" "List(list) -> new list wrapper object"
PyTypeObject listType = { PyTypeObject listType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.datetime", "psycopg2._psycopg.List",
sizeof(listObject), sizeof(listObject),
0, 0,
list_dealloc, /*tp_dealloc*/ list_dealloc, /*tp_dealloc*/

View File

@ -177,18 +177,19 @@ mxdatetime_del(PyObject* self)
static PyObject * static PyObject *
mxdatetime_repr(mxdatetimeObject *self) mxdatetime_repr(mxdatetimeObject *self)
{ {
return PyString_FromFormat("<psycopg.MxDateTime object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.MxDateTime object at %p>",
self);
} }
/* object type */ /* object type */
#define mxdatetimeType_doc \ #define mxdatetimeType_doc \
"psycopg.MxDateTime(mx, type) -> new mx.DateTime wrapper object" "MxDateTime(mx, type) -> new mx.DateTime wrapper object"
PyTypeObject mxdatetimeType = { PyTypeObject mxdatetimeType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.MxDateTime", "psycopg2._psycopg.MxDateTime",
sizeof(mxdatetimeObject), sizeof(mxdatetimeObject),
0, 0,
mxdatetime_dealloc, /*tp_dealloc*/ mxdatetime_dealloc, /*tp_dealloc*/

View File

@ -141,19 +141,20 @@ pboolean_del(PyObject* self)
static PyObject * static PyObject *
pboolean_repr(pbooleanObject *self) pboolean_repr(pbooleanObject *self)
{ {
return PyString_FromFormat("<psycopg.Boolean object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.Boolean object at %p>",
self);
} }
/* object type */ /* object type */
#define pbooleanType_doc \ #define pbooleanType_doc \
"psycopg.Boolean(str) -> new Boolean adapter object" "Boolean(str) -> new Boolean adapter object"
PyTypeObject pbooleanType = { PyTypeObject pbooleanType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.Boolean", "psycopg2._psycopg.Boolean",
sizeof(pbooleanObject), sizeof(pbooleanObject),
0, 0,
pboolean_dealloc, /*tp_dealloc*/ pboolean_dealloc, /*tp_dealloc*/

View File

@ -285,18 +285,19 @@ qstring_del(PyObject* self)
static PyObject * static PyObject *
qstring_repr(qstringObject *self) qstring_repr(qstringObject *self)
{ {
return PyString_FromFormat("<psycopg.QuotedString object at %p>", self); return PyString_FromFormat("<psycopg2._psycopg.QuotedString object at %p>",
self);
} }
/* object type */ /* object type */
#define qstringType_doc \ #define qstringType_doc \
"psycopg.QuotedString(str, enc) -> new quoted object with 'enc' encoding" "QuotedString(str, enc) -> new quoted object with 'enc' encoding"
PyTypeObject qstringType = { PyTypeObject qstringType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.QuotedString", "psycopg2._psycopg.QuotedString",
sizeof(qstringObject), sizeof(qstringObject),
0, 0,
qstring_dealloc, /*tp_dealloc*/ qstring_dealloc, /*tp_dealloc*/

View File

@ -37,11 +37,11 @@
/* cursor method - allocate a new cursor */ /* cursor method - allocate a new cursor */
#define psyco_conn_cursor_doc \ #define psyco_conn_cursor_doc \
"cursor(cursor_factory=psycopg.cursor) -> new cursor\n\n" \ "cursor(cursor_factory=psycopg2.extensions.cursor) -> new cursor\n\n" \
"Return a new cursor. The 'cursor_factory' argument can be used to\n" \ "Return a new cursor. The 'cursor_factory' argument can be used to\n" \
"create non-standard cursors by passing a class different from the\n" \ "create non-standard cursors by passing a class different from the\n" \
"default. Note that the new class *should* be a sub-class of\n" \ "default. Note that the new class *should* be a sub-class of\n" \
"'psycopg2.cursor'.\n" "'psycopg2.extensions.cursor'.\n"
static PyObject * static PyObject *
psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *keywds) psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *keywds)
@ -71,7 +71,6 @@ psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *keywds)
return obj; return obj;
} }
/* close method - close the connection and all related cursors */ /* close method - close the connection and all related cursors */
@ -92,7 +91,6 @@ psyco_conn_close(connectionObject *self, PyObject *args)
return Py_None; return Py_None;
} }
/* commit method - commit all changes to the database */ /* commit method - commit all changes to the database */
@ -335,7 +333,7 @@ connection_repr(connectionObject *self)
PyTypeObject connectionType = { PyTypeObject connectionType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.connection", "psycopg2._psycopg.connection",
sizeof(connectionObject), sizeof(connectionObject),
0, 0,
connection_dealloc, /*tp_dealloc*/ connection_dealloc, /*tp_dealloc*/

View File

@ -596,7 +596,7 @@ _psyco_curs_buildrow_fill(cursorObject *self, PyObject *res,
Dprintf("_psyco_curs_buildrow: row %ld, element %d, len %i", Dprintf("_psyco_curs_buildrow: row %ld, element %d, len %i",
self->row, i, len); self->row, i, len);
val = typecast_cast(PyTuple_GET_ITEM(self->casts, i), str, len, val = typecast_cast(PyTuple_GET_ITEM(self->casts, i), (char*)str, len,
(PyObject*)self); (PyObject*)self);
if (val) { if (val) {
@ -1331,7 +1331,7 @@ cursor_repr(cursorObject *self)
PyTypeObject cursorType = { PyTypeObject cursorType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.cursor", "psycopg2._psycopg.cursor",
sizeof(cursorObject), sizeof(cursorObject),
0, 0,
cursor_dealloc, /*tp_dealloc*/ cursor_dealloc, /*tp_dealloc*/

View File

@ -157,7 +157,7 @@ isqlquote_del(PyObject* self)
PyTypeObject isqlquoteType = { PyTypeObject isqlquoteType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, 0,
"psycopg._psycopg.ISQLQuote", "psycopg2._psycopg.ISQLQuote",
sizeof(isqlquoteObject), sizeof(isqlquoteObject),
0, 0,
isqlquote_dealloc, /*tp_dealloc*/ isqlquote_dealloc, /*tp_dealloc*/

View File

@ -295,23 +295,27 @@ PyObject *Error, *Warning, *InterfaceError, *DatabaseError,
static void static void
psyco_errors_init(void) psyco_errors_init(void)
{ {
Error = PyErr_NewException("psycopg.Error", PyExc_StandardError, NULL); Error = PyErr_NewException("psycopg2._psycopg.Error",
Warning = PyErr_NewException("psycopg.Warning", PyExc_StandardError,NULL); PyExc_StandardError, NULL);
InterfaceError = PyErr_NewException("psycopg.InterfaceError", Error, NULL); Warning = PyErr_NewException("psycopg2._psycopg.Warning",
DatabaseError = PyErr_NewException("psycopg.DatabaseError", Error, NULL); PyExc_StandardError,NULL);
InterfaceError = PyErr_NewException("psycopg2._psycopg.InterfaceError",
InternalError = Error, NULL);
PyErr_NewException("psycopg.InternalError", DatabaseError, NULL); DatabaseError = PyErr_NewException("psycopg2._psycopg.DatabaseError",
OperationalError = Error, NULL);
PyErr_NewException("psycopg.OperationalError", DatabaseError, NULL); InternalError = PyErr_NewException("psycopg2._psycopg.InternalError",
ProgrammingError = DatabaseError, NULL);
PyErr_NewException("psycopg.ProgrammingError", DatabaseError, NULL); OperationalError = PyErr_NewException("psycopg2._psycopg.OperationalError",
IntegrityError = DatabaseError, NULL);
PyErr_NewException("psycopg.IntegrityError", DatabaseError,NULL); ProgrammingError = PyErr_NewException("psycopg2._psycopg.ProgrammingError",
DataError = DatabaseError, NULL);
PyErr_NewException("psycopg.DataError", DatabaseError, NULL); IntegrityError = PyErr_NewException("psycopg2._psycopg.IntegrityError",
DatabaseError,NULL);
DataError = PyErr_NewException("psycopg2._psycopg.DataError",
DatabaseError, NULL);
NotSupportedError = NotSupportedError =
PyErr_NewException("psycopg.NotSupportedError", DatabaseError, NULL); PyErr_NewException("psycopg2._psycopg.NotSupportedError",
DatabaseError, NULL);
} }
void void

View File

@ -52,9 +52,9 @@ skip_until_space(char *s)
#endif #endif
#include "psycopg/typecast_array.c" #include "psycopg/typecast_array.c"
#include "psycopg/typecast_builtins.c" #include "psycopg/typecast_builtins.c"
/* a list of initializers, used to make the typecasters accessible anyway */ /* a list of initializers, used to make the typecasters accessible anyway */
#ifdef HAVE_PYDATETIME #ifdef HAVE_PYDATETIME
typecastObject_initlist typecast_pydatetime[] = { typecastObject_initlist typecast_pydatetime[] = {
@ -325,7 +325,7 @@ PyTypeObject typecastType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /*ob_size*/ 0, /*ob_size*/
"psycopg.type", /*tp_name*/ "psycopg2._psycopg.type", /*tp_name*/
sizeof(typecastObject), /*tp_basicsize*/ sizeof(typecastObject), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
@ -440,7 +440,7 @@ typecast_from_c(typecastObject_initlist *type, PyObject *dict)
} }
PyObject * PyObject *
typecast_cast(PyObject *obj, unsigned char *str, int len, PyObject *curs) typecast_cast(PyObject *obj, char *str, int len, PyObject *curs)
{ {
PyObject *old, *res = NULL; PyObject *old, *res = NULL;
typecastObject *self = (typecastObject *)obj; typecastObject *self = (typecastObject *)obj;

View File

@ -29,7 +29,7 @@ extern "C" {
#endif #endif
/* type of type-casting functions (both C and Python) */ /* type of type-casting functions (both C and Python) */
typedef PyObject *(*typecast_function)(unsigned char *, int len, PyObject *); typedef PyObject *(*typecast_function)(char *, int len, PyObject *);
/** typecast type **/ /** typecast type **/
@ -80,6 +80,6 @@ extern PyObject *typecast_from_python(
/* the function used to dispatch typecasting calls */ /* the function used to dispatch typecasting calls */
extern PyObject *typecast_cast( extern PyObject *typecast_cast(
PyObject *self, unsigned char *str, int len, PyObject *curs); PyObject *self, char *str, int len, PyObject *curs);
#endif /* !defined(PSYCOPG_TYPECAST_H) */ #endif /* !defined(PSYCOPG_TYPECAST_H) */

View File

@ -32,8 +32,8 @@
#define ASCAN_QUOTED 4 #define ASCAN_QUOTED 4
static int static int
typecast_array_tokenize(unsigned char *str, int strlength, typecast_array_tokenize(char *str, int strlength,
int *pos, unsigned char** token, int *length) int *pos, char** token, int *length)
{ {
/* FORTRAN glory */ /* FORTRAN glory */
int i, j, q, b, l, res; int i, j, q, b, l, res;
@ -103,7 +103,7 @@ typecast_array_tokenize(unsigned char *str, int strlength,
} }
if (res == ASCAN_QUOTED) { if (res == ASCAN_QUOTED) {
unsigned char *buffer = PyMem_Malloc(l+1); char *buffer = PyMem_Malloc(l+1);
if (buffer == NULL) return ASCAN_ERROR; if (buffer == NULL) return ASCAN_ERROR;
*token = buffer; *token = buffer;
@ -131,11 +131,11 @@ typecast_array_tokenize(unsigned char *str, int strlength,
} }
static int static int
typecast_array_scan(unsigned char *str, int strlength, typecast_array_scan(char *str, int strlength,
PyObject *curs, PyObject *base, PyObject *array) PyObject *curs, PyObject *base, PyObject *array)
{ {
int state, length, pos = 0; int state, length = 0, pos = 0;
unsigned char *token; char *token;
PyObject *stack[MAX_DIMENSIONS]; PyObject *stack[MAX_DIMENSIONS];
int stack_index = 0; int stack_index = 0;
@ -192,7 +192,7 @@ typecast_array_scan(unsigned char *str, int strlength,
have to be taken on the single items **/ have to be taken on the single items **/
static PyObject * static PyObject *
typecast_GENERIC_ARRAY_cast(unsigned char *str, int len, PyObject *curs) typecast_GENERIC_ARRAY_cast(char *str, int len, PyObject *curs)
{ {
PyObject *obj = NULL; PyObject *obj = NULL;
PyObject *base = ((typecastObject*)((cursorObject*)curs)->caster)->bcast; PyObject *base = ((typecastObject*)((cursorObject*)curs)->caster)->bcast;

View File

@ -22,9 +22,9 @@
/** INTEGER - cast normal integers (4 bytes) to python int **/ /** INTEGER - cast normal integers (4 bytes) to python int **/
static PyObject * static PyObject *
typecast_INTEGER_cast(unsigned char *s, int len, PyObject *curs) typecast_INTEGER_cast(char *s, int len, PyObject *curs)
{ {
unsigned char buffer[12]; char buffer[12];
if (s == NULL) {Py_INCREF(Py_None); return Py_None;} if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
if (s[len] != '\0') { if (s[len] != '\0') {
@ -37,9 +37,9 @@ typecast_INTEGER_cast(unsigned char *s, int len, PyObject *curs)
/** LONGINTEGER - cast long integers (8 bytes) to python long **/ /** LONGINTEGER - cast long integers (8 bytes) to python long **/
static PyObject * static PyObject *
typecast_LONGINTEGER_cast(unsigned char *s, int len, PyObject *curs) typecast_LONGINTEGER_cast(char *s, int len, PyObject *curs)
{ {
unsigned char buffer[24]; char buffer[24];
if (s == NULL) {Py_INCREF(Py_None); return Py_None;} if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
if (s[len] != '\0') { if (s[len] != '\0') {
@ -52,10 +52,10 @@ typecast_LONGINTEGER_cast(unsigned char *s, int len, PyObject *curs)
/** FLOAT - cast floating point numbers to python float **/ /** FLOAT - cast floating point numbers to python float **/
static PyObject * static PyObject *
typecast_FLOAT_cast(unsigned char *s, int len, PyObject *curs) typecast_FLOAT_cast(char *s, int len, PyObject *curs)
{ {
/* FIXME: is 64 large enough for any float? */ /* FIXME: is 64 large enough for any float? */
unsigned char buffer[64]; char buffer[64];
if (s == NULL) {Py_INCREF(Py_None); return Py_None;} if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
if (s[len] != '\0') { if (s[len] != '\0') {
@ -68,7 +68,7 @@ typecast_FLOAT_cast(unsigned char *s, int len, PyObject *curs)
/** STRING - cast strings of any type to python string **/ /** STRING - cast strings of any type to python string **/
static PyObject * static PyObject *
typecast_STRING_cast(unsigned char *s, int len, PyObject *curs) typecast_STRING_cast(char *s, int len, PyObject *curs)
{ {
if (s == NULL) {Py_INCREF(Py_None); return Py_None;} if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
return PyString_FromStringAndSize(s, len); return PyString_FromStringAndSize(s, len);
@ -77,7 +77,7 @@ typecast_STRING_cast(unsigned char *s, int len, PyObject *curs)
/** UNICODE - cast strings of any type to a python unicode object **/ /** UNICODE - cast strings of any type to a python unicode object **/
static PyObject * static PyObject *
typecast_UNICODE_cast(unsigned char *s, int len, PyObject *curs) typecast_UNICODE_cast(char *s, int len, PyObject *curs)
{ {
PyObject *enc; PyObject *enc;
@ -99,7 +99,7 @@ typecast_UNICODE_cast(unsigned char *s, int len, PyObject *curs)
/** BOOLEAN - cast boolean value into right python object **/ /** BOOLEAN - cast boolean value into right python object **/
static PyObject * static PyObject *
typecast_BOOLEAN_cast(unsigned char *s, int len, PyObject *curs) typecast_BOOLEAN_cast(char *s, int len, PyObject *curs)
{ {
PyObject *res; PyObject *res;
@ -118,10 +118,10 @@ typecast_BOOLEAN_cast(unsigned char *s, int len, PyObject *curs)
#ifdef HAVE_DECIMAL #ifdef HAVE_DECIMAL
static PyObject * static PyObject *
typecast_DECIMAL_cast(unsigned char *s, int len, PyObject *curs) typecast_DECIMAL_cast(char *s, int len, PyObject *curs)
{ {
PyObject *res = NULL; PyObject *res = NULL;
unsigned char *buffer; char *buffer;
if (s == NULL) {Py_INCREF(Py_None); return Py_None;} if (s == NULL) {Py_INCREF(Py_None); return Py_None;}

View File

@ -80,7 +80,7 @@ static PyBufferProcs chunk_as_buffer =
PyTypeObject chunkType = { PyTypeObject chunkType = {
PyObject_HEAD_INIT(NULL) PyObject_HEAD_INIT(NULL)
0, /* ob_size */ 0, /* ob_size */
"psycopg._psycopg.chunk", /* tp_name */ "psycopg2._psycopg.chunk", /* tp_name */
sizeof(chunkObject), /* tp_basicsize */ sizeof(chunkObject), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
(destructor) chunk_dealloc, /* tp_dealloc*/ (destructor) chunk_dealloc, /* tp_dealloc*/
@ -152,11 +152,11 @@ typecast_BINARY_cast_unescape(unsigned char *str, size_t *to_length)
#endif #endif
static PyObject * static PyObject *
typecast_BINARY_cast(unsigned char *s, int l, PyObject *curs) typecast_BINARY_cast(char *s, int l, PyObject *curs)
{ {
chunkObject *chunk; chunkObject *chunk;
PyObject *res; PyObject *res;
unsigned char *str, *buffer = NULL; char *str, *buffer = NULL;
size_t len; size_t len;
if (s == NULL) {Py_INCREF(Py_None); return Py_None;} if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
@ -171,7 +171,7 @@ typecast_BINARY_cast(unsigned char *s, int l, PyObject *curs)
buffer[l] = '\0'; buffer[l] = '\0';
s = buffer; s = buffer;
} }
str = PQunescapeBytea(s, &len); str = (char*)PQunescapeBytea((unsigned char*)s, &len);
Dprintf("typecast_BINARY_cast: unescaped %d bytes", len); Dprintf("typecast_BINARY_cast: unescaped %d bytes", len);
if (buffer) PyMem_Free(buffer); if (buffer) PyMem_Free(buffer);

View File

@ -34,7 +34,7 @@ extern PyObject *pyDeltaTypeP;
/** DATE - cast a date into a date python object **/ /** DATE - cast a date into a date python object **/
static PyObject * static PyObject *
typecast_PYDATE_cast(unsigned char *str, int len, PyObject *curs) typecast_PYDATE_cast(char *str, int len, PyObject *curs)
{ {
PyObject* obj = NULL; PyObject* obj = NULL;
int n, y=0, m=0, d=0; int n, y=0, m=0, d=0;
@ -67,7 +67,7 @@ typecast_PYDATE_cast(unsigned char *str, int len, PyObject *curs)
/** DATETIME - cast a timestamp into a datetime python object **/ /** DATETIME - cast a timestamp into a datetime python object **/
static PyObject * static PyObject *
typecast_PYDATETIME_cast(unsigned char *str, int len, PyObject *curs) typecast_PYDATETIME_cast(char *str, int len, PyObject *curs)
{ {
PyObject* obj = NULL; PyObject* obj = NULL;
int n, y=0, m=0, d=0; int n, y=0, m=0, d=0;
@ -131,7 +131,7 @@ typecast_PYDATETIME_cast(unsigned char *str, int len, PyObject *curs)
/** TIME - parse time into a time object **/ /** TIME - parse time into a time object **/
static PyObject * static PyObject *
typecast_PYTIME_cast(unsigned char *str, int len, PyObject *curs) typecast_PYTIME_cast(char *str, int len, PyObject *curs)
{ {
PyObject* obj = NULL; PyObject* obj = NULL;
int n, hh=0, mm=0; int n, hh=0, mm=0;
@ -160,7 +160,7 @@ typecast_PYTIME_cast(unsigned char *str, int len, PyObject *curs)
/** INTERVAL - parse an interval into a timedelta object **/ /** INTERVAL - parse an interval into a timedelta object **/
static PyObject * static PyObject *
typecast_PYINTERVAL_cast(unsigned char *str, int len, PyObject *curs) typecast_PYINTERVAL_cast(char *str, int len, PyObject *curs)
{ {
long years = 0, months = 0, days = 0; long years = 0, months = 0, days = 0;
double hours = 0.0, minutes = 0.0, seconds = 0.0, hundredths = 0.0; double hours = 0.0, minutes = 0.0, seconds = 0.0, hundredths = 0.0;

View File

@ -28,7 +28,7 @@ extern mxDateTimeModule_APIObject *mxDateTimeP;
/** DATE - cast a date into mx.DateTime python object **/ /** DATE - cast a date into mx.DateTime python object **/
static PyObject * static PyObject *
typecast_MXDATE_cast(unsigned char *str, int len, PyObject *curs) typecast_MXDATE_cast(char *str, int len, PyObject *curs)
{ {
int n, y=0, m=0, d=0; int n, y=0, m=0, d=0;
int hh=0, mm=0; int hh=0, mm=0;
@ -60,7 +60,7 @@ typecast_MXDATE_cast(unsigned char *str, int len, PyObject *curs)
/** TIME - parse time into an mx.DateTime object **/ /** TIME - parse time into an mx.DateTime object **/
static PyObject * static PyObject *
typecast_MXTIME_cast(unsigned char *str, int len, PyObject *curs) typecast_MXTIME_cast(char *str, int len, PyObject *curs)
{ {
int n, hh=0, mm=0; int n, hh=0, mm=0;
double ss=0.0; double ss=0.0;
@ -84,7 +84,7 @@ typecast_MXTIME_cast(unsigned char *str, int len, PyObject *curs)
/** INTERVAL - parse an interval into an mx.DateTimeDelta **/ /** INTERVAL - parse an interval into an mx.DateTimeDelta **/
static PyObject * static PyObject *
typecast_MXINTERVAL_cast(unsigned char *str, int len, PyObject *curs) typecast_MXINTERVAL_cast(char *str, int len, PyObject *curs)
{ {
long years = 0, months = 0, days = 0, denominator = 1; long years = 0, months = 0, days = 0, denominator = 1;
double hours = 0.0, minutes = 0.0, seconds = 0.0, hundredths = 0.0; double hours = 0.0, minutes = 0.0, seconds = 0.0, hundredths = 0.0;