Fabian wrote:
Martijn Faassen wrote:
[snip]
Unfortunately, it needs to be 'varchar(20)', not just plain 'varchar'. Just 'varchar' apparently does *not* result in an error, but instead all subsequent insert operations plus the select operation do nothing whatsoever; the fetching returns no results at all.
This is weird, because I once added a very explanatory error message for this situation. Using JDBC it seems this message is indeed generated:
% JdbcClient -hlocalhost Connection warning: database specifier not supported on this server (mserver_sql), protocol version 4 Welcome to the MonetDB interactive JDBC terminal! Database: MonetDB 4.8.0_rc1 Driver: MonetDB Native Driver 1.2 (Blunt) Type \q to quit, \h for a list of available commands auto commit mode: on monetdb-> create table emp(name varchar, age int); Error: CHARACTER VARYING needs a mandatory length specification in: "create table emp(name varchar,"
Right, this would've been a great error message indeed to have seen. :)
monetdb->
So, I suspect the code sample to be faulty or the error reporting not to be optimal in this case for MAPI.
The code sample is quite thorough in catching any error that Mapi may return (NULL value) and then to display it. Unfortunately NULL does not appear to be returned, so no error condition is noticed. Perhaps this is a case of: Almost every call can fail since the connection with the database server can fail at any time. Functions that return a handle (either Mapi or MapiHdl) may return NULL on failure, or they may return the handle with the error flag set. If the function returns a non-NULL handle, always check for errors with mapi_error. The sample code on the page is not doing this 'always checking for errors'. I shall try to modify it to do so, as it'd be good to have the sample do the right thing.
Additionally, all subsequent inserts are bound to fail, but not silently. If you use auto commit mode, then you would get an error:
monetdb-> insert into emp values ('bla', 300); Error: Inserting into non existing table emp
I tried auto commit mode, but that didn't seem to have any effect. Anyway, perhaps the errors are indeed there and just not caught by the C code. [snip]
There is always an error, but it simply doesn't reach you. I'm no MAPI expert. Sjoerd might see what's the problem here for this example. I included Sjoerd in the CC of this message.
Okay, thanks. I will try to see whether mapi_error does the trick. Regards, Martijn