private Database.LinkRequest MakeLink(string tableName, int instanceId, long rowFrom)
        {
            var lr = new Database.LinkRequestTable();

            lr.LinkToOpen           = new Database.TableLink();
            lr.LinkToOpen.TableName = tableName;
            var b = new Database.View.Where.Builder("NativeInstanceId", Operator.Equal, new Expression.MetaExpression(instanceId.ToString(), true));

            lr.LinkToOpen.RowWhere = new System.Collections.Generic.List <Database.View.Where.Builder>();
            lr.LinkToOpen.RowWhere.Add(b);
            lr.SourceTable  = m_Table;
            lr.SourceColumn = this;
            lr.SourceRow    = rowFrom;

            return(lr);
        }
        public override Database.LinkRequest GetRowLink(long row)
        {
            var obj = m_Table.GetObjectData(row).displayObject;

            if (!m_Table.IsGroupLinked(obj))
            {
                return(null);
            }
            switch (obj.dataType)
            {
            case ObjectDataType.Array:
            case ObjectDataType.Object:
            {
                var lr = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = ObjectTable.TableName;
                lr.SourceTable          = m_Table;
                lr.SourceColumn         = this;
                lr.SourceRow            = row;
                lr.Parameters.Add(ObjectTable.ObjParamName, new Database.Operation.ExpConst <ulong>(obj.hostManagedObjectPtr));
                lr.Parameters.Add(ObjectTable.TypeParamName, new Database.Operation.ExpConst <int>(obj.managedTypeIndex));
                return(lr);
            }

            case ObjectDataType.ReferenceArray:
            case ObjectDataType.ReferenceObject:
            {
                ulong result = obj.GetReferencePointer();
                if (result == 0)
                {
                    return(null);
                }
                var lr = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = ObjectTable.TableName;
                lr.SourceTable          = m_Table;
                lr.SourceColumn         = this;
                lr.SourceRow            = row;
                lr.Parameters.Add(ObjectTable.ObjParamName, new Database.Operation.ExpConst <ulong>(result));
                return(lr);
            }

            default:
                return(null);
            }
        }
        public override Database.LinkRequest GetRowLink(long row)
        {
            var obj = m_Table.GetObjectData(row).displayObject;
            int i   = obj.GetUnifiedObjectIndex(m_Table.Snapshot);

            if (i >= 0)
            {
                var lr = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = ObjectReferenceTable.kObjectReferenceTableName;
                lr.SourceTable          = m_Table;
                lr.SourceColumn         = this;
                lr.SourceRow            = row;
                lr.Parameters.AddValue(ObjectTable.ObjParamName, i);
                return(lr);
            }
            return(null);
        }