Changeset 801
- Timestamp:
- 03/07/07 21:21:59 (2 years ago)
- Files:
-
- pg8000/trunk/pg8000.py (modified) (4 diffs)
- pg8000/trunk/pg8000-test.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pg8000/trunk/pg8000.py
r800 r801 593 593 self.verifyState("ready") 594 594 self._send(Protocol.Parse(statement, qs, [type(x) for x in params])) 595 self._send(Protocol.Bind(portal, statement, ( 1,), params, (1,)))595 self._send(Protocol.Bind(portal, statement, (0,), params, (0,))) 596 596 self._send(Protocol.DescribePortal(portal)) 597 597 self._send(Protocol.Flush()) … … 741 741 return int(data) 742 742 743 def int4out(v): 744 return str(v) 745 743 746 def int4send(v): 744 747 return struct.pack("!i", v) … … 757 760 return datetime.datetime(year, month, day, hour, minute, sec) 758 761 762 def numeric_in(data, description): 763 if data.find(".") == -1: 764 return int(data) 765 else: 766 return decimal(data) 767 768 def numeric_out(v): 769 return str(v) 770 759 771 py_types = { 760 int: ( 23, None, int4send),772 int: (1700, numeric_out, None), 761 773 } 762 774 … … 766 778 23: (int4in, int4recv), 767 779 1114: (timestamp_in, timestamp_recv), 780 1700: (numeric_in, None), 768 781 } 769 782 pg8000/trunk/pg8000-test.py
r800 r801 28 28 29 29 print "begin query..." 30 cur1.execute("SELECT 5000 + 1 as int_test, True as bool_test, '2000-01-02 03:04:05.67'::timestamp as timestamp_test ")30 cur1.execute("SELECT 5000 + 1 as int_test, True as bool_test, '2000-01-02 03:04:05.67'::timestamp as timestamp_test, 22::numeric") 31 31 for row in cur1: 32 32 print repr(row)
