I'm not sure I follow you.  Here's an MCLIENT session to demonstrate what I observe:

sql>COPY INTO alert_tbl FROM STDIN USING DELIMITERS ',','\\n','\"';
COPY INTO: no such table 'alert_tbl'
sql>rollback;
auto commit mode: off
sql>COPY INTO clk.alert_tbl FROM STDIN USING DELIMITERS ',','\\n','\"';
more>

Note how when I issue a bad COPY INTO command, I immediately get a prompt telling me it was no good.

Note how when I issue a good COPY INTO command, I immediately get a prompt asking for more.

That 2nd prompt manifests in my code as a null response to waitForPrompt(), and it does so consistently.

I just tested my proposed change to the example and it works consistently.  Have you tested the example with and without a bad COPY INTO?

Cheers,
Percy

P.S. To be safe, I've now switched to using COPY INTO ... FROM file and just write my files to /dev/shm



On Sat, Feb 9, 2013 at 4:31 AM, Fabian Groffen <fabian@monetdb.org> wrote:
Hi Percy,

On 08-02-2013 12:07:30 -0600, Percy Wegmann wrote:
> The solution is to add something like the following after the out.newLine()
> on line 86:
>
> error = in.waitForPrompt();
>
> if (error != null) {
>
>     throw new Exception(error);
>
> }

I'm surprised this works for you.  It shouldn't as a matter of fact.
Since we don't flush, the server /can/ tell us it read something it is
certain of it was a complete statement, but isn't happy with, but we
didn't say we finished our command yet, so it could /also/ say it only
once we finish sending all we got.  Therefore we can't wait for a
prompt, there shouldn't be one to come here, as we didn't flush (=
indefinite hang).

In any case, waiting for a prompt there is a wrong thing to do, even if
it accidentially seems to work.  A bug in the server (due to streams
being taken over) causes this behaviour, but you should never rely on
it.

That said, feel free to use the hack, but I'm not going to add it to the
example.


--
Fabian Groffen                              fabian@monetdb.org
column-store pioneer               http://www.monetdb.org/Home

_______________________________________________
users-list mailing list
users-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/users-list




--

Percy Wegmann
+1 512 637 8500 ext 148