From: Florian G. <re...@us...> - 2006-10-30 21:35:12
|
Update of /cvsroot/perfparse/_perfparse/db_tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1270/db_tools Modified Files: convert.c convert.h Log Message: some small changes Index: convert.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** convert.c 29 Oct 2006 22:29:34 -0000 1.3 --- convert.c 30 Oct 2006 21:35:06 -0000 1.4 *************** *** 112,115 **** --- 112,116 ---- printf(_("Creating new group table:\n")); query("create table perfdata_groups (group_id INT AUTO_INCREMENT PRIMARY KEY, group_name VARCHAR(75) UNIQUE) type=InnoDB select group_name from perfdata_host_group"); + DropForeignKey("perfdata_host","perfdata_host_group"); query("drop table perfdata_host_group"); } *************** *** 135,141 **** void DropForeignKey(char *TableName, char *ForeignTableName) { GString *querystr=g_string_new(""); ! GString *resultstr=g_string_new(""); g_string_printf(querystr,"show create table %s",TableName); ! query(querystr); } --- 136,151 ---- void DropForeignKey(char *TableName, char *ForeignTableName) { GString *querystr=g_string_new(""); ! GString *resultstr; g_string_printf(querystr,"show create table %s",TableName); ! query(querystr->str); ! #ifdef USE_DB_MYSQL ! while ((result_row = mysql_fetch_row(query_result))) { ! #elif defined USE_DB_POSTGRESQL ! numberOfRows = rows(); ! for (currentRow=0;currentRow<numberOfRows;currentRow++){ ! #endif ! resultstr=g_string_new(result_row[0]); ! printf("Resultstring: %s\n",resultstr->str); ! } } Index: convert.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** convert.h 26 Sep 2005 14:36:33 -0000 1.1.1.1 --- convert.h 30 Oct 2006 21:35:06 -0000 1.2 *************** *** 4,8 **** * * Copyright (c) 2004 Ben Clewett (per...@cl...) ! * Last Modified: 2004-05-28 * * License: --- 4,8 ---- * * Copyright (c) 2004 Ben Clewett (per...@cl...) ! * $Id$ * * License: *************** *** 31,34 **** --- 31,35 ---- void autoConvert(); void install_database(void); + void DropForeignKey(char *TableName, char *ForeignTableName); #endif |