From: Florian G. <re...@us...> - 2007-04-03 22:21:09
|
Update of /cvsroot/perfparse/_perfparse/db_tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30932/db_tools Modified Files: convert.c Log Message: schema fine tuning and more conversion Index: convert.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** convert.c 1 Apr 2007 22:39:44 -0000 1.24 --- convert.c 3 Apr 2007 22:21:07 -0000 1.25 *************** *** 494,498 **** if(result_row_old[2]!=NULL) { iRawPolicyInd=atoi(result_row_old[2])*86400; ! g_string_append_printf(gsNDBSql,",raw_delete_individual"); g_string_append_printf(gsNDBSql2,",%d",iRawPolicyInd); } --- 494,498 ---- if(result_row_old[2]!=NULL) { iRawPolicyInd=atoi(result_row_old[2])*86400; ! g_string_append_printf(gsNDBSql,",raw_delete_policy_individual"); g_string_append_printf(gsNDBSql2,",%d",iRawPolicyInd); } *************** *** 506,510 **** if(result_row_old[5]!=NULL) { iBinPolicyInd=atoi(result_row_old[5])*86400; ! g_string_append_printf(gsNDBSql,",bin_delete_individual"); g_string_append_printf(gsNDBSql2,",%d",iBinPolicyInd); } --- 506,510 ---- if(result_row_old[5]!=NULL) { iBinPolicyInd=atoi(result_row_old[5])*86400; ! g_string_append_printf(gsNDBSql,",bin_delete_policy_individual"); g_string_append_printf(gsNDBSql2,",%d",iBinPolicyInd); } *************** *** 528,532 **** printw(_("\ndone\n")); refresh(); ! /* --- 528,582 ---- printw(_("\ndone\n")); refresh(); ! ! ! // Step 4 ! iStep++; ! printw(_("(Step %d of %d)\n"),iStep,iNumSteps); ! printw(_("Copying data of perfdata_service table.\n")); ! refresh(); ! ! g_string_printf(gsODBSql, "select host_name,service_description,last_perfdata_raw,raw_delete_policy,raw_delete_policy_name,raw_delete_policy_type,is_deleted from perfdata_service"); ! query_result_old=dbtool_mysql_query(gsODBSql->str, &db_mysql_old,query_result_old); ! iODBnumrows=dbtool_rows(query_result_old); ! printw("Affected rows: %d\n",iODBnumrows);refresh(); ! getyx(stdscr,y,x); ! i=0; ! ! ! while ((result_row_old=mysql_fetch_row(query_result_old))) { ! i++; ! int iRawPolicyId=-1; ! int iRawPolicyInd=-1; ! int Hid=-1; ! ! move(y,x); ! piODBlengths=mysql_fetch_lengths(query_result_old); ! ! printw(_("Copying entry %d/%d"),i,iODBnumrows); refresh(); ! Hid=get_hostId_from_name(result_row_old[0],&db_mysql_new); ! g_string_printf(gsNDBSql, "insert ignore into perfdata_service(host_id,service_description,is_deleted"); ! g_string_printf(gsNDBSql2," values(%d,'%s',%s",Hid,result_row_old[1],result_row_old[6]); ! // get raw delete policy id if template ! if(strncmp(result_row_old[5],"template",4)==0) { ! iRawPolicyId=get_policyId_from_name(result_row_old[4],&db_mysql_new); ! g_string_append_printf(gsNDBSql,",raw_delete_policy_id"); ! g_string_append_printf(gsNDBSql2,",%d",iRawPolicyId); ! } else { ! if(result_row_old[3]!=NULL) { ! iRawPolicyInd=atoi(result_row_old[3])*86400; ! g_string_append_printf(gsNDBSql,",raw_delete_policy_individual"); ! g_string_append_printf(gsNDBSql2,",%d",iRawPolicyInd); ! } ! } ! ! g_string_append_printf(gsNDBSql2,")"); ! g_string_append_printf(gsNDBSql,")%s",gsNDBSql2->str); ! ! // printw("debug: Sql Statement: %s\n",gsNDBSql->str);refresh(); ! dbtool_mysql_query(gsNDBSql->str, &db_mysql_new, query_result_new); ! } ! printw(_("\ndone\n")); refresh(); ! ! /* |