简体   繁体   中英

C# - PostgreSQL (NpgSql) bytea data transfer progress

Dear Stack Overflow community,

I am using PostgreSQL databases from C# with the NpgSql .Net connector.

I want to have a progress bar when I transfer a bytea to and from a PostgreSQL. I have searched a lot but I cannot find any possible work around.

What I use is a PostgreSQL function that inserts or retrieve a file stored in a bytea column. Perhaps, I can store the file size when I upload it from my application to set the ProgressBar.Maximum property, but I do not know how to see the current amount of bytes transferred in the NpgsqlConnection (or NpgsqlCommand).

Thank you very much in advanced, Ignacio.

Dear Stackoverflow community ,

I have asked this question in the pgFoundary and Francisco kindly answered my questions as follows. I want to share it with you.


Regarding your question, I think this isn't possible because Npgsql doesn't report back how many bytes have been written to the database while sending the data.

One possible workaround would you to use the Large Object support ( you can find a working example in manual.npgsql.org ) where your application would send bytes in blocks so you could update your UI about the progress.


Thank you, Ignacio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM