| Thread overview | |||||
|---|---|---|---|---|---|
|
January 15, 2015 Why foreach do not print value during every single Insert request in SQL? | ||||
|---|---|---|---|---|
| ||||
void IMGsInsert(string [] fullimgurl)
{
foreach (url; fullimgurl)
{
string sqlinsert = (sqlrequest)
writeln(sqlinsert);
write("|");
auto rs = stmt.executeUpdate(sqlinsert);
}
}
I expect nice progress indicator "|" which move forward after every Insert request.
Like:
||||
and so on.
The problem that App wait some time and only in prints a heap of "|". Why?
| ||||
January 15, 2015 Re: Why foreach do not print value during every single Insert request in SQL? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Suliman | On 16/01/2015 1:05 a.m., Suliman wrote:
> void IMGsInsert(string [] fullimgurl)
> {
> foreach (url; fullimgurl)
> {
> string sqlinsert = (sqlrequest)
> writeln(sqlinsert);
> write("|");
> auto rs = stmt.executeUpdate(sqlinsert);
> }
>
> }
>
> I expect nice progress indicator "|" which move forward after every
> Insert request.
> Like:
> ||||
> and so on.
>
> The problem that App wait some time and only in prints a heap of "|". Why?
That writeln won't be helping anything. Other then that?
No idea sorry.
| |||
January 15, 2015 Re: Why foreach do not print value during every single Insert request in SQL? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Thursday, 15 January 2015 at 12:05:24 UTC, Suliman wrote:
> void IMGsInsert(string [] fullimgurl)
> {
> foreach (url; fullimgurl)
> {
> string sqlinsert = (sqlrequest)
> writeln(sqlinsert);
> write("|");
> auto rs = stmt.executeUpdate(sqlinsert);
> }
>
> }
>
> I expect nice progress indicator "|" which move forward after every Insert request.
> Like:
> ||||
> and so on.
>
> The problem that App wait some time and only in prints a heap of "|". Why?
Terminal output is line-buffered by default. To display an incomplete line to the user, add "stdout.flush()" after your "write" call.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply