Skip to content

Handling infinity results in a graceful manner. #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions MdxClient/MdxCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class MdxCommand : DbCommand
private readonly XNamespace _namespace = "urn:schemas-microsoft-com:xml-analysis:mddataset";
private readonly XNamespace _xsiNs = "http://www.w3.org/2001/XMLSchema-instance";
private IEnumerable<ColumnMap> _columnMap;
private static readonly string[] invalid = new[] { "NAN", "INF", "-INF" };
#endregion

#region constructors
Expand Down Expand Up @@ -613,8 +614,12 @@ private void AddRows(IEnumerable<Tuple> rows, List<Cell> cells, int rowColumnCou
// this is done because the xml coming back does not include nulls/empty data. We have to fill in the gap or the subsequent objects will throw the data off
if (Convert.ToInt32(cell.Ordinal) == i)
{
cellToAdd = cell;
AdjustValueFromColumnType(cellToAdd, cell.Ordinal % (columnCountFromColumnAxis) + rowColumnCount, crs);
// Do this only if it's not infinity or NaN
if (!(cell.Type != "xsd:string" && cell.Value != null && invalid.Contains(cell.Value.ToString())))
{
cellToAdd = cell;
AdjustValueFromColumnType(cellToAdd, cell.Ordinal % (columnCountFromColumnAxis) + rowColumnCount, crs);
}
cellsIndexer++;
}
}
Expand Down
15 changes: 15 additions & 0 deletions MdxClient/MdxConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ internal AdomdConnection Connection
}
}

public String SessionID
{
get { return _connection.SessionID; }
set { _connection.SessionID = value; }
}

protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
{
if (IsolationLevel.Unspecified == isolationLevel || IsolationLevel.ReadCommitted == isolationLevel)
Expand All @@ -67,6 +73,15 @@ public override void Close()
_connection.Close();
}

/// <summary>
/// Closes the connection to the database, while giving an option to leave the session open.
/// </summary>
/// <param name="endSession">If false, the session will remain open so it can be reused</param>
public void Close(bool endSession)
{
_connection.Close(endSession);
}

/// <summary>
/// Gets or sets the string used to open a SQL Server Analysis Services database.
/// </summary>
Expand Down