Skip to content

Commit

Permalink
Solution for DNET-770 issue.
Browse files Browse the repository at this point in the history
INSERT (...) RETURNING (...) statement:
* Works fine when using ExecuteScalar ()
* Does not work when using Executereader ()

http://tracker.firebirdsql.org/browse/DNET-770
  • Loading branch information
ralmsdeveloper committed Sep 1, 2017
1 parent be47d81 commit 70d99c6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
Expand Up @@ -314,8 +314,14 @@ public override DbValue[] Fetch()
{
throw new InvalidOperationException("Statement is not correctly created.");
}
if (_statementType != DbStatementType.Select &&
_statementType != DbStatementType.SelectForUpdate)
if (_statementType == DbStatementType.StoredProcedure
&& !_allRowsFetched && _state == StatementState.Executed
&& _outputParams.Count > 0 && _fields.Count > 0)
{
_allRowsFetched = true;
return GetOutputParameters();
}
else if (_statementType != DbStatementType.Select && _statementType != DbStatementType.SelectForUpdate)
{
return null;
}
Expand Down
Expand Up @@ -365,8 +365,14 @@ public override DbValue[] Fetch()
{
throw new InvalidOperationException("Statement is not correctly created.");
}
if (_statementType != DbStatementType.Select &&
_statementType != DbStatementType.SelectForUpdate)
if (_statementType == DbStatementType.StoredProcedure
&& !_allRowsFetched && _state == StatementState.Executed
&& _outputParams.Count > 0 && _fields.Count > 0)
{
_allRowsFetched = true;
return GetOutputParameters();
}
else if (_statementType != DbStatementType.Select && _statementType != DbStatementType.SelectForUpdate)
{
return null;
}
Expand Down
Expand Up @@ -287,7 +287,11 @@ internal bool HasImplicitTransaction

internal bool IsSelectCommand
{
get { return _statement != null && (_statement.StatementType == DbStatementType.Select || _statement.StatementType == DbStatementType.SelectForUpdate); }
get
{
return _statement != null && (_statement.StatementType == DbStatementType.Select || _statement.StatementType == DbStatementType.SelectForUpdate
|| (_statement.StatementType == DbStatementType.StoredProcedure && _statement.Fields.Count > 0));
}
}

internal bool IsDDLCommand
Expand Down

0 comments on commit 70d99c6

Please sign in to comment.