/// <summary> Запись потока в LargeObject</summary>
        public static bool WriteLargeObject(this PGSQLDataAccess pgda, int loid, System.IO.Stream io, int blockSize = 512 * 1024)
        {
            var result = false;

            pgda.UseTransaction((dc) =>
            {
                var fd = Convert.ToInt32(new PGSQLCommand("SELECT lo_open(:p0,:p1)", loid, 0x20000).ExecuteScalar(dc));
                try
                {
                    var buff = new byte[blockSize];
                    int len;
                    try
                    {
                        new PGSQLCommand("SELECT lo_truncate(:p0, 0)", fd).ExecuteNonQuery(dc);
                        var cmd = new PGSQLCommand("SELECT lowrite(:p0, :p1)", fd, buff);
                        do
                        {
                            len = io.Read(buff, 0, blockSize);
                            if (len != blockSize)
                            {
                                var newbuff = new byte[len];
                                Array.Copy(buff, newbuff, len);
                                buff      = newbuff;
                                cmd["p1"] = newbuff;
                            }
                            cmd.ExecuteScalar(dc);
                        }while (len == blockSize);

                        result = true;
                    }
                    catch//(Exception ex)
                    {
                        result = false;
                    }
                }
                finally
                {
                    new PGSQLCommand("SELECT lo_close(:p0)", fd).ExecuteNonQuery(dc);
                }
            });
            return(result);
        }
        /// <summary> Чтение LargeObject в поток</summary>
        public static bool ReadLargeObject(this PGSQLDataAccess pgda, int loid, System.IO.Stream io, int blockSize = 512 * 1024)
        {
            var result = false;

            pgda.UseTransaction((dc) =>
            {
                var fd = Convert.ToInt32(new PGSQLCommand("SELECT lo_open(:p0,:p1)", loid, 0x40000).ExecuteScalar(dc));
                try
                {
                    int len;
                    try
                    {
                        var cmd = new PGSQLCommand("SELECT loread(:p0, :p1)", fd, blockSize);
                        do
                        {
                            var buff = (byte[])cmd.ExecuteScalar(dc);
                            len      = buff.Length;
                            if (len > 0)
                            {
                                io.Write(buff, 0, len);
                            }
                        }while (len == blockSize);
                        result = true;
                    }
                    catch//(Exception ex)
                    {
                        result = false;
                    }
                }
                finally
                {
                    new PGSQLCommand("SELECT lo_close(:p0)", fd).ExecuteNonQuery(dc);
                }
            });
            return(result);
        }