Пример #1
0
 /// <summary>
 /// Gets the row values for a row of the result set in a the form of a string
 /// array. <code>null</code> values are interperted as empty strings.
 /// </summary>
 /// <param name="row">The row to get the values for.</param>
 /// <returns>The string array of the row values.</returns>
 public static String[] GetRowStringValues(Row row) {
   object[] rowValues = GetRowValues(row);
   List<string> rowStringValues = new List<string>();
   foreach (object obj in rowValues) {
     rowStringValues.Add(getTextValue(obj));
   }
   return rowStringValues.ToArray();
 }
    public void TestGetTextValueNumberSetValue() {
      NumberValue numberValue1 = new NumberValue();
      NumberValue numberValue2 = new NumberValue();
      numberValue1.value = "1";
      numberValue2.value = "2";

      SetValue setValue = new SetValue();
      setValue.values = new Value[] { numberValue1, numberValue2 };
      Row row = new Row();
      row.values = new Value[] { setValue };
      string[] stringValues = PqlUtilities.GetRowStringValues(row);
      Assert.AreEqual(1, stringValues.Length);
      Assert.AreEqual("1,2", stringValues[0]);
    }
Пример #3
0
 /// <summary>
 /// Gets the row values for a row of the result set in the form of an object
 /// array.
 /// </summary>
 /// <param name="row">The row to get the values for.</param>
 /// <returns>The object array of the row values.</returns>
 public static object[] GetRowValues(Row row) {
   List<object> rowValues = new List<object>();
   foreach (Value value in row.values) {
     rowValues.Add(GetValue(value));
   }
   return rowValues.ToArray();
 }
    public void TestGetTextValueCommaTextSetValue() {
      TextValue textValue1 = new TextValue();
      TextValue textValue2 = new TextValue();
      textValue1.value = "value1";
      textValue2.value = "comma \",\" separated";

      SetValue setValue = new SetValue();
      setValue.values = new Value[] { textValue1, textValue2 };
      Row row = new Row();
      row.values = new Value[] { setValue };
      string[] stringValues = PqlUtilities.GetRowStringValues(row);
      Assert.AreEqual(1, stringValues.Length);
      Assert.AreEqual("value1,\"comma \"\",\"\" separated\"", stringValues[0]);
    }