~psycopg/psycopg/2.0.x

« back to all changes in this revision

Viewing changes to psycopg/psycopgmodule.c

  • Committer: Federico Di Gregorio
  • Date: 2009-01-22 23:09:20 UTC
  • Revision ID: fog@initd.org-20090122230920-3o0yr9v00990klog
Added adapter to handle float('inf') and float('nan')

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include "psycopg/adapter_qstring.h"
37
37
#include "psycopg/adapter_binary.h"
38
38
#include "psycopg/adapter_pboolean.h"
 
39
#include "psycopg/adapter_pfloat.h"
39
40
#include "psycopg/adapter_asis.h"
40
41
#include "psycopg/adapter_list.h"
41
42
#include "psycopg/typecast_binary.h"
271
272
{
272
273
    PyObject *call;
273
274
 
274
 
    microprotocols_add(&PyFloat_Type, NULL, (PyObject*)&asisType);
 
275
    microprotocols_add(&PyFloat_Type, NULL, (PyObject*)&pfloatType);
275
276
    microprotocols_add(&PyInt_Type, NULL, (PyObject*)&asisType);
276
277
    microprotocols_add(&PyLong_Type, NULL, (PyObject*)&asisType);
277
278
    microprotocols_add(&PyBool_Type, NULL, (PyObject*)&pbooleanType);
629
630
    {"QuotedString",  (PyCFunction)psyco_QuotedString,
630
631
     METH_VARARGS, psyco_QuotedString_doc},
631
632
    {"Boolean",  (PyCFunction)psyco_Boolean,
 
633
     METH_VARARGS, psyco_Float_doc},
 
634
    {"Float",  (PyCFunction)psyco_Float,
632
635
     METH_VARARGS, psyco_Boolean_doc},
633
636
    {"Binary",  (PyCFunction)psyco_Binary,
634
637
     METH_VARARGS, psyco_Binary_doc},
693
696
    binaryType.ob_type     = &PyType_Type;
694
697
    isqlquoteType.ob_type  = &PyType_Type;
695
698
    pbooleanType.ob_type   = &PyType_Type;
 
699
    pfloatType.ob_type     = &PyType_Type;
696
700
    asisType.ob_type       = &PyType_Type;
697
701
    listType.ob_type       = &PyType_Type;
698
702
    chunkType.ob_type      = &PyType_Type;
704
708
    if (PyType_Ready(&binaryType) == -1) return;
705
709
    if (PyType_Ready(&isqlquoteType) == -1) return;
706
710
    if (PyType_Ready(&pbooleanType) == -1) return;
 
711
    if (PyType_Ready(&pfloatType) == -1) return;
707
712
    if (PyType_Ready(&asisType) == -1) return;
708
713
    if (PyType_Ready(&listType) == -1) return;
709
714
    if (PyType_Ready(&chunkType) == -1) return;
804
809
    binaryType.tp_alloc = PyType_GenericAlloc;
805
810
    isqlquoteType.tp_alloc = PyType_GenericAlloc;
806
811
    pbooleanType.tp_alloc = PyType_GenericAlloc;
 
812
    pfloatType.tp_alloc = PyType_GenericAlloc;
807
813
    connectionType.tp_alloc = PyType_GenericAlloc;
808
814
    asisType.tp_alloc = PyType_GenericAlloc;
809
815
    qstringType.tp_alloc = PyType_GenericAlloc;