[GRASSLIST:9431] Re: DBMI errors with MySQL tables

Dylan Beaudette dylan.beaudette at gmail.com
Mon Dec 12 20:46:45 EST 2005


On Monday 12 December 2005 04:30 pm, Hamish wrote:
> On Mon, 12 Dec 2005 15:40:25 -0800
>
> Dylan Beaudette <dylan.beaudette at gmail.com> wrote:
> > On Monday 12 December 2005 02:50 pm, Hamish wrote:
> > > > | db_ring_hz1    | float       | YES  |     | NULL    |       |
> > > > | db_ring_hz2    | float       | YES  |     | NULL    |       |
> > > > | db_ring_hz3    | float       | YES  |     | NULL    |       |
> > > > | db_ring_hz4    | float       | YES  |     | NULL    |       |
> > >
> > > DBF has a 10 char limit to names. Maybe a test for this this is
> > > polluting the mysql driver somehow? try making the above four
> > > different in the first 10 chars?
> >
> > Thanks for the quick feedback Hamish. I am not sure that I understand
> > what you  are suggesting... Do you mean that 10+ character names in
> > MySQL are causing  the problems? I don't think this is the case, as
> > when i replace my NULL  values with empty strings or '0' everything
> > works fine- even with the long  names.
> >
> > is that what you meant?
>
> Yea, it probably isn't that, but I mentioned it as I noticed in those
> four the first 10 chars are not unique. I know that shouldn't affect it,
> but you never know...
>
> Probably the NULL handling has to be followed in a debugger to see where
> it goes wrong. Have you run GRASS with `g.gisenv set="DEBUG=5"` to
> narrow down when the DBMI error happens?
>
>
> Hamish

Thanks for the tips. Here are the results when I up' the debug level:

g.gisenv set="DEBUG=5"
echo "select *" | db.select table=db_null_test


D2/5: opendir /usr/local/grass-6.1.cvs/driver/db/

D2/5: opendir /usr/local/grass-6.1.cvs/driver/db/

D3/5: db_driver_open_database() driver = mysql database definition = 
'host=localhost,dbname=test'
D3/5: parse_conn : host=localhost,dbname=test
D3/5: token 0 : host=localhost
D3/5: token 1 : dbname=test
D3/5: host = localhost, port = 0, socket = (null), dbname = test, user = 
(null), password = (null)
D3/5: db_get_login(): mysql host=localhost,dbname=test
D3/5: file = /home/dylan/.grasslogin6
D3/5: ret = 4 : mysql host=localhost,dbname=test xxx xxx
D3/5: ret = 4 : mysql test at localhost xxx xxx
D3/5: load_table()
D3/5: load_table() - not loaded
D3/5: load_table() - number of cols is 1
D3/5: load_table() - number of cols is 2
dbmi: Protocol error

Looks like something is breaking in the load_table() function ? 

Hmmmmm...

Poking around in this source code for CVS, the following matches look 
interesting:

grep -n -R "load_table()" .

./db/drivers/mysql/table.c:113:    G_debug(3, "load_table()");
./db/drivers/mysql/table.c:117:    G_debug(3, "load_table() - not loaded");
./db/drivers/mysql/table.c:193: G_debug(3, "load_table() - number of cols is 
%d", db.tables[t].ncols);


Not sure how to interpret these debug messages...

Further ideas? maybe we are getting closer...?

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list