Skip to content

Commit 5994145

Browse files
committed
Address issue where DB does not set a RETURNING INTO bind. (GitHub issue #343.)
1 parent 9e5d366 commit 5994145

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/njs/src/njsConnection.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,8 @@ void Connection::Async_Execute (uv_work_t *req)
14981498
executeBaton->rowsAffected = executeBaton->dpistmt->rowsAffected();
14991499

15001500
// Check whether indicators were allocated as part of callback
1501-
if ( executeBaton->stmtIsReturning )
1501+
// Address GitHub issue #343
1502+
if ( executeBaton->stmtIsReturning && executeBaton->rowsAffected )
15021503
{
15031504
for ( unsigned int b = 0; b < executeBaton->binds.size (); b++ )
15041505
{
@@ -3750,6 +3751,8 @@ void Connection::cbDynBufferAllocate ( void *ctx, bool dmlReturning,
37503751
// rowsReturns for INSERT will be zero,
37513752
// but we still need to allocate one descriptor
37523753
bind->rowsReturned = 1;
3754+
// initialize indicator to null
3755+
*(bind->ind) = -1;
37533756
if (nRows > 1)
37543757
bind->rowsReturned = nRows;
37553758
// allocate the array of Descriptor **

0 commit comments

Comments
 (0)