Esempio n. 1
0
        public static void ToArray <T>(StreamWriter sw, T[] data, Func <T, PostgresTuple> converter)
        {
            if (data == null)
            {
                sw.Write("NULL");
                return;
            }
            var arr = new PostgresTuple[data.Length];

            for (int i = 0; i < data.Length; i++)
            {
                arr[i] = converter(data[i]);
            }
            sw.Write('\'');
            var tuple = new ArrayTuple(arr);

            tuple.InsertRecord(sw, string.Empty, PostgresTuple.EscapeQuote);
            sw.Write('\'');
        }
Esempio n. 2
0
        public static void ToArray <T>(StreamWriter sw, IEnumerable <T> data, Func <T, PostgresTuple> converter)
        {
            if (data == null)
            {
                sw.Write("NULL");
                return;
            }
            var list = new List <PostgresTuple>();

            foreach (var item in data)
            {
                list.Add(converter(item));
            }
            sw.Write('\'');
            var arr = new ArrayTuple(list.ToArray());

            arr.InsertRecord(sw, string.Empty, PostgresTuple.EscapeQuote);
            sw.Write('\'');
        }