Skip to content

Commit aa7a437

Browse files
committed
Added a check to report an error when the DB is not reporting an error in DML RETURNING statements.
1 parent 9dff2f4 commit aa7a437

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## node-oracledb v1.2.0 (DD Mon YYYY)
44

5+
- Added a check to return an NJS error when an invalid DML RETURN statement
6+
does not give an ORA error.
7+
58
- Added support for RAW data type.
69

710
- Fixed intermittent crash while setting `fetchAsString`, and incorrect output while reading the value.

src/njs/src/njsConnection.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,20 @@ void Connection::Async_Execute (uv_work_t *req)
931931
executeBaton->dpistmt->execute(1, executeBaton->autoCommit);
932932
executeBaton->rowsAffected = executeBaton->dpistmt->rowsAffected();
933933

934+
// Check whether indicators were allocated as part of callback
935+
if ( executeBaton->stmtIsReturning )
936+
{
937+
for ( unsigned int b = 0; b < executeBaton->binds.size (); b++ )
938+
{
939+
if ( executeBaton->binds[b]->isOut && !executeBaton->binds[b]->ind)
940+
{
941+
executeBaton->error = NJSMessages::getErrorMsg (
942+
errSQLSyntaxError );
943+
return;
944+
}
945+
}
946+
}
947+
934948
/* Check to see if the string buffer size is good in case of
935949
* DML Returning.
936950
*/

src/njs/src/njsMessages.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static const char *errMsg[] =
6060
"NJS-024: memory allocation failed",
6161
"NJS-025: overflow when calculating results area size",
6262
"NJS-026: maxRows must be greater than zero",
63+
"NJS-027: unexpected SQL parsing error",
6364
"NJS-027: raw database type is not supported with DML Returning statements",
6465
};
6566

src/njs/src/njsMessages.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ typedef enum
5959
errInsufficientMemory,
6060
errResultsTooLarge,
6161
errInvalidmaxRows,
62+
errSQLSyntaxError,
6263
errBufferReturningInvalid,
6364

6465
// New ones should be added here

0 commit comments

Comments
 (0)