Permalink
Browse files

support FLOAT type

  • Loading branch information...
1 parent 2e19839 commit 1abcc99438b2a6142671b649700118099144827d @nakagami committed Apr 5, 2011
Showing with 7 additions and 4 deletions.
  1. +2 −0 firebirdsql/fbcore.py
  2. +5 −4 firebirdsql/tests.py
@@ -356,6 +356,8 @@ def value(self, raw_value):
yyyy, mm, dd = self._parse_date(raw_value[:4])
h, m, s, ms = self._parse_time(raw_value[4:])
return datetime.datetime(yyyy, mm, dd, h, m, s, ms)
+ elif self.sqltype == SQL_TYPE_FLOAT:
+ return struct.unpack('!f', raw_value)[0]
elif self.sqltype == SQL_TYPE_DOUBLE:
return struct.unpack('!d', raw_value)[0]
else:
@@ -38,16 +38,17 @@
g TIME DEFAULT '23:45:01',
h BLOB SUB_TYPE 0,
i DOUBLE PRECISION DEFAULT 0.0,
+ j FLOAT DEFAULT 0.0,
PRIMARY KEY (a),
CONSTRAINT CHECK_A CHECK (a <> 0)
)
''')
conn.commit()
conn.cursor().execute("insert into foo(a, b, c) values (1, 'a', 'b')")
- conn.cursor().execute("""insert into foo(a, b, c, e, g, i)
- values (2, 'A', 'B', '1999-01-25', '00:00:01', 0.1)""")
- conn.cursor().execute("""insert into foo(a, b, c, e, g, i)
- values (3, 'X', 'Y', '2001-07-05', '00:01:02', 0.2)""")
+ conn.cursor().execute("""insert into foo(a, b, c, e, g, i, j)
+ values (2, 'A', 'B', '1999-01-25', '00:00:01', 0.1, 0.1)""")
+ conn.cursor().execute("""insert into foo(a, b, c, e, g, i, j)
+ values (3, 'X', 'Y', '2001-07-05', '00:01:02', 0.2, 0.2)""")
conn.commit()
conn.cursor().execute("update foo set c='Hajime' where a=1")
conn.cursor().execute("update foo set c=? where a=2", ['Nakagami'])

0 comments on commit 1abcc99

Please sign in to comment.