Deveel.Data.TableContainerBase.FindByName C# (CSharp) Method

FindByName() public method

public FindByName ( ObjectName name ) : int
name ObjectName
return int
        public virtual int FindByName(ObjectName name)
        {
            if (Transaction.RealTableExists(TableName)) {
                // Search the table.  We assume that the schema and name of the object
                // are in columns 0 and 1 respectively.
                var table = Transaction.GetTable(TableName);
                using (var rowE = table.GetEnumerator()) {
                    int p = 0;
                    while (rowE.MoveNext()) {
                        int rowIndex = rowE.Current.RowId.RowNumber;
                        var obName = table.GetValue(rowIndex, NameColumnOffset);
                        if (obName.Value.ToString().Equals(name.Name)) {
                            var obSchema = table.GetValue(rowIndex, SchemaColumnOffset);
                            if (obSchema.Value.ToString().Equals(name.ParentName)) {
                                // Match so return this
                                return p;
                            }
                        }
                        ++p;
                    }
                }
            }

            return -1;
        }