Beispiel #1
0
 public int GetColumnOrdinal(ColumnName columnName)
 {
     if (columnName.CompareTo (new ColumnName (0)) == 0)
         return 0;
     else
         return -1;
 }
Beispiel #2
0
        public int GetColumnOrdinal(ColumnName columnName)
        {
            if (columnNameList == null)
                throw new InvalidOperationException (string.Format ("Column name {0} not found", columnName));

            return Array.FindIndex (columnNameList, a => a.CompareTo (columnName) == 0);
        }
Beispiel #3
0
        public int GetColumnOrdinal(ColumnName columnName)
        {
            if (columnName.Alias != null) {
                if (StringComparer.InvariantCultureIgnoreCase.Compare (columnName.Alias, this.Alias) != 0)
                    //throw new InvalidOperationException (string.Format ("Unexpected provider alias {0} when expecting {1}", columnName.Alias, this.Alias));
                    return -1;
                else
                    columnName = new ColumnName (null, columnName.Name);
            }

            return provider.GetColumnOrdinal (columnName);
        }
 public static int GetColumnIndex(ColumnName columnName)
 {
     switch (columnName)
     {
         case ColumnName.TESTID:
             return 1;
         case ColumnName.DESCRIPTION:
             return 2;
         case ColumnName.IN_ID:
             return 3;
         case ColumnName.CLIENT_NAME:
             return 4;
         default:
             throw new ArgumentException("Invalid Column Heading in Data Source Schema ");
     }
 }
Beispiel #5
0
    private bool FindValue(Annotation a, ColumnName key, out string value)
    {
      if (nameKeyMap.ContainsKey(key))
      {
        HashSet<string> keys = nameKeyMap[key];
        foreach (var ck in keys)
        {
          if (a.Annotations.ContainsKey(ck))
          {
            value = (a.Annotations[ck] as string).Trim();
            return true;
          }
        }
      }

      value = StatusValue.NA;
      return false;
    }
Beispiel #6
0
 public int GetColumnOrdinal(ColumnName columnName)
 {
     return -1;
 }
 protected bool Equals(ColumnName other)
 {
     return string.Equals(m_Name.ToLowerInvariant(), other.m_Name.ToLowerInvariant());
 }
Beispiel #8
0
 public int GetColumnOrdinal(ColumnName columnName)
 {
     return Array.FindIndex (columnNames, a => a.CompareTo (columnName) == 0);
 }
 public int GetColumnOrdinal(ColumnName columnName)
 {
     return Array.FindIndex (columnNameList, a => (columnName.Alias != null && a.Alias != null || columnName.Alias == null) && a.CompareTo (columnName) == 0);
 }
Beispiel #10
0
 public SingleColumn(ColumnName columnName, IExpression expr)
     : base(columnName)
 {
     Expression = expr;
 }
Beispiel #11
0
 private string FindValue(Annotation a, ColumnName key)
 {
   string result;
   FindValue(a, key, out result);
   return result;
 }
Beispiel #12
0
        public void Initialize(GqlQueryState gqlQueryState)
        {
            regex = new Regex (regexDefinition, caseInsensitive ? RegexOptions.IgnoreCase : RegexOptions.None);
            string[] groups = regex.GetGroupNames ();
            columnNameList = groups.Skip (1).Select (p => new ColumnName (p)).ToArray ();
            for (int i = 0; i < columnNameList.Length; i++)
                if (groups [i + 1] == (i + 1).ToString ())
                    columnNameList [i] = new ColumnName (i);
                else
                    columnNameList [i] = new ColumnName (groups [i + 1]);
            provider.Initialize (gqlQueryState);

            record = new ProviderRecord (this, true);
            dataStrings = new DataString[columnNameList.Length];
            for (int i = 0; i < dataStrings.Length; i++) {
                dataStrings [i] = new DataString ();
                record.Columns [i] = dataStrings [i];
            }
        }
        public virtual void Initialize(GqlQueryState gqlQueryState)
        {
            provider.Initialize (gqlQueryState);
            firstLine = ReadLine ();
            int columns = columnCount;
            if (columns == -1)
                columns = firstLine != null ? firstLine.Length : 0;

            if (columns == -1)
                throw new Exception ("No columns found in delimited file");

            columnNameList = new ColumnName[columns];
            for (int i = 0; i < columnNameList.Length; i++)
                columnNameList [i] = new ColumnName (i);
            dataString = new DataString[columns];

            record = new ProviderRecord (this, false);
        }
Beispiel #14
0
 public Column(ColumnName columnName)
     : base(columnName)
 {
 }
 /// <summary>
 /// Gets the name of the column.
 /// </summary>
 /// <param name="dbName">Name of the db.</param>
 /// <param name="extraction">The extraction.</param>
 /// <param name="nameFormat">The name format.</param>
 /// <returns></returns>
 public ColumnName GetColumnName(string dbName, WordsExtraction extraction, NameFormat nameFormat)
 {
     var words = GetLanguageWords(nameFormat.Culture);
     var columnName = new ColumnName { DbName = dbName };
     columnName.NameWords = ExtractWords(words, dbName, extraction);
     // if no extraction (preset name, just copy it)
     if (extraction == WordsExtraction.None)
         columnName.PropertyName = dbName;
     else
         columnName.PropertyName = Format(words, columnName.NameWords, nameFormat.Case, Singularization.DontChange);
     return columnName;
 }
Beispiel #16
0
 public int GetColumnOrdinal(ColumnName columnName)
 {
     return providers [0].GetColumnOrdinal (columnName);
 }
Beispiel #17
0
 static void ConstructColumns(IList<Column> outputColumns, out IExpression[] outputList2, out ColumnName[] columnNameList2)
 {
     List<IExpression> outputList = new List<IExpression> ();
     List<ColumnName> columnNameList = new List<ColumnName> ();
     for (int i = 0; i < outputColumns.Count; i++) {
         Column column = outputColumns [i];
         if (column is AllColums) {
             AllColums allColums = (AllColums)column;
             var columnNameList3 = allColums.Provider.GetColumnNames ();
             for (int j = 0; j < columnNameList3.Length; j++) {
                 if (allColums.ProviderAlias == null
                     || StringComparer.InvariantCultureIgnoreCase.Compare (allColums.ProviderAlias, columnNameList3 [j].Alias) == 0) {
                     outputList.Add (GqlParser.ConstructColumnExpression (allColums.Provider, j));
                     columnNameList.Add (columnNameList3 [j]);
                 }
             }
             if (columnNameList.Count == 0)
                 throw new InvalidOperationException (string.Format ("No columns found for provider alias {0}", allColums.ProviderAlias));
         } else if (column is SingleColumn) {
             SingleColumn singleColumn = (SingleColumn)column;
             outputList.Add (singleColumn.Expression);
             columnNameList.Add (singleColumn);
         } else {
             throw new InvalidOperationException (string.Format ("Unknown column type {0}", column.GetType ()));
         }
     }
     outputList2 = outputList.ToArray ();
     columnNameList2 = columnNameList.ToArray ();
     for (int i = 0; i < columnNameList2.Length; i++)
         if (columnNameList2 [i] == null || string.IsNullOrEmpty (columnNameList2 [i].Name))
             columnNameList2 [i] = new ColumnName (i);
 }