Skip to content
Browse files

fetch callproc return values

  • Loading branch information...
1 parent c14708c commit 82e41ee39b840507a169308ab90aff59558cca4f @nakagami committed Dec 10, 2011
Showing with 16 additions and 7 deletions.
  1. +1 −2 firebirdsql/fbcore.py
  2. +15 −5 firebirdsql/wireprotocol.py
View
3 firebirdsql/fbcore.py
@@ -473,7 +473,6 @@ def _execute(self, query, params):
def _callproc(self, query, params):
cooked_params = self._convert_params(params)
-
stmt_handle = self.stmt_handle
self.transaction.connection._op_prepare_statement(stmt_handle,
self.transaction.trans_handle, query)
@@ -486,7 +485,7 @@ def _callproc(self, query, params):
self.transaction.connection._op_execute2(stmt_handle,
self.transaction.trans_handle, cooked_params,
calc_blr(self._xsqlda))
- return self.transaction.connection._op_sql_response()
+ return self.transaction.connection._op_sql_response(self._xsqlda)
def prep(self, query):
prepared_statement = PreparedStatement(self, query)
View
20 firebirdsql/wireprotocol.py
@@ -678,15 +678,25 @@ def _op_response(self):
return (h, oid, buf)
@wire_operation
- def _op_sql_response(self):
+ def _op_sql_response(self, xsqlda):
b = recv_channel(self.sock, 4)
while bytes_to_bint(b) == self.op_dummy:
b = recv_channel(self.sock, 4)
if bytes_to_bint(b) != self.op_sql_response:
raise InternalError
- b = recv_channel(self.sock, 8)
+ b = recv_channel(self.sock, 4)
count = bytes_to_bint(b[0:4])
- buf_len = bytes_to_bint(b[4:])
- buf = recv_channel(self.sock, buf_len, True)
- return buf
+
+ r = [None] * len(xsqlda)
+ for i in range(len(xsqlda)):
+ x = xsqlda[i]
+ if x.io_length() < 0:
+ b = recv_channel(self.sock, 4)
+ ln = bytes_to_bint(b)
+ else:
+ ln = x.io_length()
+ raw_value = recv_channel(self.sock, ln, True)
+ if recv_channel(self.sock, 4) == bytes([0]) * 4: # Not NULL
+ r[i] = x.value(raw_value)
+ return r

0 comments on commit 82e41ee

Please sign in to comment.
Something went wrong with that request. Please try again.