@ -225,6 +225,8 @@ update_table_list(db_info * dbi)
* tables to the list that are new
* tables to the list that are new
*/
*/
res = send_query ( ( char * ) TABLE_STATS_QUERY , dbi ) ;
res = send_query ( ( char * ) TABLE_STATS_QUERY , dbi ) ;
if ( res ! = NULL )
{
t = PQntuples ( res ) ;
t = PQntuples ( res ) ;
/*
/*
@ -289,6 +291,7 @@ update_table_list(db_info * dbi)
}
}
}
}
} /* end of for loop that adds tables */
} /* end of for loop that adds tables */
}
fflush ( LOGOUTPUT ) ;
fflush ( LOGOUTPUT ) ;
PQclear ( res ) ;
PQclear ( res ) ;
res = NULL ;
res = NULL ;
@ -410,6 +413,8 @@ init_db_list()
if ( dbs - > conn ! = NULL )
if ( dbs - > conn ! = NULL )
{
{
res = send_query ( FROZENOID_QUERY , dbs ) ;
res = send_query ( FROZENOID_QUERY , dbs ) ;
if ( res ! = NULL )
{
dbs - > oid = atooid ( PQgetvalue ( res , 0 , PQfnumber ( res , " oid " ) ) ) ;
dbs - > oid = atooid ( PQgetvalue ( res , 0 , PQfnumber ( res , " oid " ) ) ) ;
dbs - > age = atol ( PQgetvalue ( res , 0 , PQfnumber ( res , " age " ) ) ) ;
dbs - > age = atol ( PQgetvalue ( res , 0 , PQfnumber ( res , " age " ) ) ) ;
if ( res )
if ( res )
@ -418,6 +423,9 @@ init_db_list()
if ( args - > debug > = 2 )
if ( args - > debug > = 2 )
print_db_list ( db_list , 0 ) ;
print_db_list ( db_list , 0 ) ;
}
}
else
return NULL ;
}
return db_list ;
return db_list ;
}
}
@ -488,6 +496,8 @@ update_db_list(Dllist *db_list)
* add databases to the list that are new
* add databases to the list that are new
*/
*/
res = send_query ( FROZENOID_QUERY2 , dbi_template1 ) ;
res = send_query ( FROZENOID_QUERY2 , dbi_template1 ) ;
if ( res ! = NULL )
{
t = PQntuples ( res ) ;
t = PQntuples ( res ) ;
/*
/*
@ -560,6 +570,7 @@ update_db_list(Dllist *db_list)
}
}
}
}
} /* end of for loop that adds tables */
} /* end of for loop that adds tables */
}
fflush ( LOGOUTPUT ) ;
fflush ( LOGOUTPUT ) ;
PQclear ( res ) ;
PQclear ( res ) ;
res = NULL ;
res = NULL ;
@ -599,7 +610,10 @@ xid_wraparound_check(db_info * dbi)
res = send_query ( " VACUUM " , dbi ) ;
res = send_query ( " VACUUM " , dbi ) ;
/* FIXME: Perhaps should add a check for PQ_COMMAND_OK */
/* FIXME: Perhaps should add a check for PQ_COMMAND_OK */
if ( res ! = NULL )
{
PQclear ( res ) ;
PQclear ( res ) ;
}
return 1 ;
return 1 ;
}
}
return 0 ;
return 0 ;
@ -750,7 +764,7 @@ check_stats_enabled(db_info * dbi)
int ret = 0 ;
int ret = 0 ;
res = send_query ( " SHOW stats_row_level " , dbi ) ;
res = send_query ( " SHOW stats_row_level " , dbi ) ;
if ( res )
if ( res ! = NULL )
{
{
ret = strcmp ( " on " , PQgetvalue ( res , 0 , PQfnumber ( res , " stats_row_level " ) ) ) ;
ret = strcmp ( " on " , PQgetvalue ( res , 0 , PQfnumber ( res , " stats_row_level " ) ) ) ;
PQclear ( res ) ;
PQclear ( res ) ;
@ -1079,6 +1093,8 @@ main(int argc, char *argv[])
res = send_query ( TABLE_STATS_QUERY , dbs ) ; /* Get an updated
res = send_query ( TABLE_STATS_QUERY , dbs ) ; /* Get an updated
* snapshot of this dbs
* snapshot of this dbs
* table stats */
* table stats */
if ( res ! = NULL )
{
for ( j = 0 ; j < PQntuples ( res ) ; j + + )
for ( j = 0 ; j < PQntuples ( res ) ; j + + )
{ /* loop through result set */
{ /* loop through result set */
tbl_elem = DLGetHead ( dbs - > table_list ) ; /* Reset tbl_elem to top
tbl_elem = DLGetHead ( dbs - > table_list ) ; /* Reset tbl_elem to top
@ -1154,6 +1170,7 @@ main(int argc, char *argv[])
} /* end for table while loop */
} /* end for table while loop */
} /* end for j loop (tuples in PGresult) */
} /* end for j loop (tuples in PGresult) */
} /* end if (res != NULL) */
} /* close of if(xid_wraparound_check()) */
} /* close of if(xid_wraparound_check()) */
/* Done working on this db, Clean up, then advance cur_db */
/* Done working on this db, Clean up, then advance cur_db */
PQclear ( res ) ;
PQclear ( res ) ;