Skip to content

Commit

Permalink
blob bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nakagami committed Nov 24, 2011
1 parent 08179b5 commit 96bdf1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions firebirdsql/fbcore.py
Expand Up @@ -434,7 +434,7 @@ def _convert_params(self, params):
param = self.transaction.connection.str_to_bytes(param)
cooked_params.append(param)
continue
self.transaction.connection._op_create_blob2()
self.transaction.connection._op_create_blob2(self.transaction.trans_handle)
(blob_handle, blob_id, buf2) = self.transaction.connection._op_response()
seg_size = self.transaction.connection.buffer_length
(seg, remains) = param[:seg_size], param[seg_size:]
Expand Down Expand Up @@ -502,7 +502,7 @@ def _fetch_generator(self, stmt_handle):
if x.sqltype == SQL_TYPE_BLOB:
if not r[i]:
continue
connection._op_open_blob(r[i])
connection._op_open_blob(r[i], self.transaction.trans_handle)
(h, oid, buf) = connection._op_response()
v = bytes([])
n = 1 # 1:mora data 2:no more data
Expand Down
8 changes: 4 additions & 4 deletions firebirdsql/wireprotocol.py
Expand Up @@ -513,18 +513,18 @@ def _op_detach(self):
send_channel(self.sock, p.get_buffer())

@wire_operation
def _op_open_blob(self, blob_id):
def _op_open_blob(self, blob_id, trans_handle):
p = xdrlib.Packer()
p.pack_int(self.op_open_blob)
p.pack_int(self.trans_handle)
p.pack_int(trans_handle)
send_channel(self.sock, p.get_buffer() + blob_id)

@wire_operation
def _op_create_blob2(self):
def _op_create_blob2(self, trans_handle):
p = xdrlib.Packer()
p.pack_int(self.op_create_blob2)
p.pack_int(0)
p.pack_int(self.trans_handle)
p.pack_int(trans_handle)
p.pack_int(0)
p.pack_int(0)
send_channel(self.sock, p.get_buffer())
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.py
Expand Up @@ -39,7 +39,7 @@ def debug_print(msg):
e DATE DEFAULT '1967-08-11',
f TIMESTAMP DEFAULT '1967-08-11 23:45:01',
g TIME DEFAULT '23:45:01',
h BLOB SUB_TYPE 0,
h BLOB SUB_TYPE 1,
i DOUBLE PRECISION DEFAULT 0.0,
j FLOAT DEFAULT 0.0,
PRIMARY KEY (a),
Expand Down Expand Up @@ -92,7 +92,7 @@ def debug_print(msg):
cur.close()

# 3 records insert
conn.cursor().execute("insert into foo(a, b, c) values (1, 'a', 'b')")
conn.cursor().execute("insert into foo(a, b, c,h) values (1, 'a', 'b','This is a memo')")
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)
Expand Down

0 comments on commit 96bdf1f

Please sign in to comment.