[sr-dev] git:master: modules/mtree: when loading data from db, load each tree separately

Juha Heinanen jh at tutpro.com
Wed Oct 30 16:49:53 CET 2013


Daniel-Constantin Mierla writes:

> mtree module works with two types of database tables:
> - one having only (tprefix, tvalue)
> - one having also tree name (tname, tprefix, tvalue)
> 
> Your change seems to affect the first case, which is supposed not to 
> have tname column, thus not working.

there is another function mt_load_db_trees() that load all the trees at
one shot. my change didn't affect that branch of the code.

-- juha

	if(mt_defined_trees())
	{
		LM_DBG("static trees defined\n");

		pt = mt_get_first_tree();

		while(pt!=NULL)
		{
		        LM_DBG("loading from tree <%.*s>\n",
			        pt->tname.len, pt->tname.s);

			/* loading all information from database */
			if(mt_load_db(&pt->tname)!=0)
			{
				LM_ERR("cannot load info from database\n");
				goto error1;
			}
			pt = pt->next;
		}
	} else {
		if(db_table.len<=0)
		{
			LM_ERR("no trees table defined\n");
			goto error1;
		}
		if(mt_init_list_head()<0)
		{
			LM_ERR("unable to init trees list head\n");
			goto error1;
		}
		/* loading all information from database */
		if(mt_load_db_trees()!=0)
		{
			LM_ERR("cannot load trees from database\n");
			goto error1;
		}
	}



More information about the sr-dev mailing list