Re: Possible BUG in dlr.c (sdb_callbackk_add() CVS)

David Chkhartishvili <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization MagtiCom Ltd.
Message-ID <[email protected]>
Stipe Tolj wrote:

>>After recompiling CVS tree with sdb support (oracle), I got error from
>>sdb_callback_add function: Row has wrong length 1.
>>
>>For some reasons it only looks for p[0] value, but it only contains
>>dlrmask field, p[1] is service type and p[2] is url.
>>In my case:
>>p[0] -- 3
>>p[1] -- 1
>>p[2] -- http://localhost/dlr.php?type=%d&id=11
>>
>>Please tell me why we expect that all 3 values are in p[0]?
>>    
>>
>
>because p[0] contains the whole row 1, p[1] contains the whole row 2,
>etc.
>
>Hence in this DLR usage, we select for one row and everything should
>be in p[0]. Then we have to split that into the single attributes.
>
>At least this worked for me using mysql. I can not image that sdb is
>acting differently for the others dbs, because that would break the
>whole abstraction concept.
>
>Can you check using sdb_client, doing the same SQL statement and see
>how many lines are actualy printf'ed?!
>
>Stipe
>
>[email protected]
>-------------------------------------------------------------------
>Wapme Systems AG
>
>Vogelsanger Weg 80
>40470 Düsseldorf
>
>Tel: +49-211-74845-0
>Fax: +49-211-74845-299
>
>E-Mail: [email protected]
>Internet: http://www.wapme-systems.de
>-------------------------------------------------------------------
>wapme.net - wherever you are
>
>  
>
sdb_client returned 1 line, but actually there is 3 lines.

from sdb_client.c:

static int db_callback(int n, char **p, void *closure)
{
	int i;

	if (!n) return 0;
	for (i = 0; i < n; i++) {
		printf("%s ", p[i]);
	}
	printf("\n");
	return 0;
}

As you see they printf-ed p[i] without "\n", that's why we see 1 line in 
sdb_client output.





-- 
David Chkhartishvili
Tel: 995 99 182418
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.