public string GetTablePathFromTableName(string userTableName)
{
//For user usage
_sync_openTablesHolder.EnterReadLock();
try
{
byte[] btTableName = GetUserTableNameAsByte(userTableName);
LTrieRow row = LTrie.GetKey(btTableName, true);
if (!row.Exists)
{
return String.Empty;
}
byte[] fullValue = row.GetFullValue(true);
//Can be parsed different. First protocol version is 1
ushort schemeProtocol = fullValue.Substring(0, 2).To_UInt16_BigEndian();
ulong fileName = 0;
switch (schemeProtocol)
{
case 1:
fileName = fullValue.Substring(2, 8).To_UInt64_BigEndian();
break;
default:
throw DBreezeException.Throw(DBreezeException.eDBreezeExceptions.SCHEME_FILE_PROTOCOL_IS_UNKNOWN);
}
string alternativeTableLocation = String.Empty;
if (CheckAlternativeTableLocationsIntersections(userTableName, out alternativeTableLocation))
{
if (alternativeTableLocation == String.Empty)
return "MEMORY";
else
return Path.Combine(alternativeTableLocation, fileName.ToString());
}
else
{
return Path.Combine(Engine.MainFolder, fileName.ToString());
}
}
finally
{
_sync_openTablesHolder.ExitReadLock();
}
}