On Wed, February 14, 2007 02:49, Moritz Lennert wrote:
Hello Martin,
Markus tells me that you might participate in trying to debug the vector
db problems we are having in winGRASS.
Paul and I have both failed to find the reason up to now. It seems to me
that the (or at least the first...) problem is with the table description,
and within that most probably in the column description (
db__recv_*_definition in xdrtable.c and xdrcolumn.c in lib/db/dbmi_base/).
I don't know if Paul has come to the same conclusion.
I think I have been able to get closer to the exact point of the problem.
Using db.select as the test case, the error seems to happen around a call
to xdr_int() in lib/db/dbmi_base/xdrstring.c.
Below you can see the debug output. Everything marked with 'Moritz:' are
my debugging statements. As you can see the problem seems to be the next
attempt of reading a string after the first column name was read. This
happens either on the second column name, if there are more than one
column, or on the attempt to read the table name in xdrtable.c after
having read the (unique) column name.
The problem is in line 105 of lib/db/dbmi_base/xdrstring.c:
if(!xdr_int (&xdrs, &len) || len <= 0) /* len will include the null byte */
len = 0 in this case.
IIUC, xdr_int() is an internal function of the XDR library, so maybe there
are some specificities with the Windows version of this library which we
need to take into account ?
Moritz
****Debug output******
GRASS 6.3.cvs (BELGIQUE):C:\grass\bin >db.select communes
D2/3: opendir c:/grass/grass-6.3.cvs\driver\db\
D2/3: opendir c:/grass/grass-6.3.cvs\driver\db\
D2/3: Moritz: before xdr_int
D2/3: Moritz: len = 38
D2/3: Moritz: before xdr_int in xdrstring.c
D2/3: Moritz: len = 1
D2/3: DBF: db__driver_open_database() name =
'$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
D3/3: tokens[0] = $GISDBASE
D3/3: -> C:/GRASSDATA
D3/3: tokens[1] = $LOCATION_NAME
D3/3: -> BELGIQUE
D3/3: tokens[2] = $MAPSET
D3/3: -> PERMANENT
D3/3: tokens[3] = dbf
D2/3: db.name = C:/GRASSDATA/BELGIQUE/PERMANENT/dbf/
D2/3: add_table(): table = communes name = communes.dbf
D2/3: add_table(): table = ssbel01 name = ssbel01.dbf
D2/3: Moritz: beginning of sel()
D2/3: Moritz: before xdr_int in xdrstring.c
D2/3: Moritz: len = 23
D3/3: SQL statement parsed successfully: select * from communes
D2/3: find_table(): table = communes
D2/3: ? communes
D2/3: load_table_head(): tab = 0,
C:/GRASSDATA/BELGIQUE/PERMANENT/dbf//communes.
dbf
D2/3: ncols = 3
D2/3: DBFFieldType 1
D3/3: add_column(): tab = 0, type = 2, name = COMCOD, width = 11, decimals
= 0
D2/3: DBFFieldType 1
D3/3: add_column(): tab = 0, type = 2, name = COMCOD2, width = 11,
decimals = 0
D2/3: DBFFieldType 1
D3/3: add_column(): tab = 0, type = 2, name = COMCOD3, width = 11,
decimals = 0
D3/3: Doing SQL command <4> on DBF table... (see include/sqlp.h)
D2/3: SELECT
D2/3: sel(): tab = 0
D2/3: load_table(): tab = 0
D2/3: ncols = 3 nrows = 622
D2/3: load_table_head(): tab = 0,
C:/GRASSDATA/BELGIQUE/PERMANENT/dbf//communes.
dbf
D2/3: Moritz xdrtable.c: Number of columns in table = 3
D2/3: Before DB_RECV_COLUMN_DEFINITION in xdrtable.c - col = 0
D2/3: Moritz: before DB_RECV_STRING 1 in xdrcolumns.c
D2/3: Moritz: before xdr_int in xdrstring.c
D2/3: Moritz: len = 7
D2/3: col = COMCOD
D2/3: Moritz: before DB_RECV_STRING 2 in xdrcolumns.c
D2/3: Moritz: before xdr_int in xdrstring.c
D2/3: Moritz: len = 1
D2/3: After DB_RECV_COLUMN_DEFINITION in xdrtable.c
D2/3: Before DB_RECV_COLUMN_DEFINITION in xdrtable.c - col = 1
D2/3: Moritz: before DB_RECV_STRING 1 in xdrcolumns.c
D2/3: Moritz: before xdr_int in xdrstring.c
D2/3: Moritz: in xdr_int in xdrstring.c
len = 0
dbmi: Protocol error
^^^^^^^^^^^^^^^^^^^^
D2/3: Moritz: after db_open_select_cursor()
D2/3: Moritz: after sel()
dbmi: Protocol error
D2/3: dbmi: Protocol error
save_table 0
D2/3: save_table 1
dbmi: Protocol error