Changeset 824

Show
Ignore:
Timestamp:
03/09/07 22:20:23 (1 year ago)
Author:
mfenniak
Message:

Disable binary format timestamp due to failure on servers with HAVE_INT64_TIMESTAMP.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pg8000/trunk/pg8000.py

    r823 r824  
    765765 
    766766        def _send(self, msg): 
    767             #print repr(msg) 
    768767            data = msg.serialize() 
    769768            self._sock.send(data) 
     
    10871086 
    10881087    def py_value(v, description, **kwargs): 
    1089         print repr(v), repr(description) 
    10901088        if v == None: 
    10911089            # special case - NULL value 
     
    11431141        return float(data) 
    11441142 
    1145     def timestamp_recv(data, **kwargs): 
    1146         val = struct.unpack("!d", data)[0] 
    1147         print "timestamp_recv", repr(val), repr(data) 
    1148         return datetime.datetime(2000, 1, 1) + datetime.timedelta(seconds = val) 
     1143    # The timestamp_recv function is sadly not in use because some PostgreSQL 
     1144    # servers are compiled with HAVE_INT64_TIMESTAMP, and some are not.  This 
     1145    # alters the binary format of the timestamp, cannot be perfectly detected, 
     1146    # and there is no message from the server indicating which format is in 
     1147    # use.  Ah, well, obviously binary formats are hit-and-miss... 
     1148    #def timestamp_recv(data, **kwargs): 
     1149    #    val = struct.unpack("!d", data)[0] 
     1150    #    return datetime.datetime(2000, 1, 1) + datetime.timedelta(seconds = val) 
    11491151 
    11501152    def timestamp_in(data, **kwargs): 
     
    12241226        1042: {"txt_in": varcharin}, # CHAR type 
    12251227        1043: {"txt_in": varcharin}, # VARCHAR type 
    1226         1114: {"txt_in": timestamp_in, "bin_in": timestamp_recv, "prefer": "bin"}, 
     1228        1114: {"txt_in": timestamp_in}, #, "bin_in": timestamp_recv, "prefer": "bin"}, 
    12271229        1186: {"txt_in": interval_in}, 
    12281230        1700: {"txt_in": numeric_in}, 
  • pg8000/trunk/pg8000-test.py

    r823 r824  
    113113cur1.execute("SELECT '2001-02-03 04:05:06.17'::timestamp") 
    114114retval = tuple(cur1.iterate_dict()) 
    115 print repr(retval) 
    116115assert retval == ({'timestamp': datetime.datetime(2001, 2, 3, 4, 5, 6, 170000)},) 
    117116