void
process_query (MYSQL *conn, char *query)
{
MYSQL_RES *res_set;
unsigned int field_count;

	if (mysql_query (conn, query) != 0)	/* the query failed */
	{
		print_error (conn, "process_query () failed");
		return;
	}

	/* the query succeeded; determine whether or not it returns data */

	res_set = mysql_store_result (conn);
	if (res_set == NULL)	/* no result set was returned */
	{
		/*
		 * does the lack of a result set indicate
		 * an error or that no data was expected?
		 */
		if (mysql_num_fields (conn) > 0)
		{
			/*
			 * fields were expected, but mysql_store_result ()
			 * returned none; this means an error occurred
			 */
			print_error (conn, "Problem processing result set");
		}
		else
		{
			/*
			 * no fields were expected; query returned no data
			 * (it was not a SELECT, SHOW, DESCRIBE, or EXPLAIN),
			 * so just report number of rows affected by query
			 */
			printf ("%lu rows affected\n",
						(unsigned long) mysql_affected_rows (conn));
		}
	}
	else	/* a result set was returned */
	{
		/* process rows, then free the result set */
		process_result_set (conn, res_set);
		mysql_free_result (res_set);
	}
}
