Skip to content

Commit

Permalink
DNET-415, DNET-416
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Mar 2, 2012
1 parent e68bed5 commit b0a8aa6
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions NETProvider/source/FirebirdSql/Data/Services/FbService.cs
Expand Up @@ -199,10 +199,12 @@ protected void Close()

protected void StartTask()
{
bool shouldClose = false;
if (this.state == FbServiceState.Closed)
{
// Attach to Service Manager
this.Open();
shouldClose = true;
}

try
Expand All @@ -214,27 +216,44 @@ protected void StartTask()
{
throw new FbException(ex.Message, ex);
}
finally
{
if (shouldClose)
{
this.Close();
}
}
}

protected byte[] QueryService(byte[] items)
{
bool shouldClose = false;
if (this.state == FbServiceState.Closed)
{
// Attach to Service Manager
this.Open();
shouldClose = true;
}

if (this.querySpb == null)
{
this.querySpb = new ServiceParameterBuffer();
}

// Response buffer
byte[] buffer = new byte[this.queryBufferSize];

this.svc.Query(this.querySpb, items.Length, items, buffer.Length, buffer);

return buffer;
try
{
// Response buffer
byte[] buffer = new byte[this.queryBufferSize];
this.svc.Query(this.querySpb, items.Length, items, buffer.Length, buffer);
return buffer;
}
finally
{
if (shouldClose)
{
this.Close();
}
}
}

protected ArrayList ParseQueryInfo(byte[] buffer)
Expand Down

0 comments on commit b0a8aa6

Please sign in to comment.