Exemple #1
0
/**
 * Return the show variables output a a result set
 *
 * @return Variables as a result set
 */
RESULTSET *
maxinfo_variables()
{
RESULTSET	*result;
static VARCONTEXT	context;

	context.like = NULL;
	context.index = 0;

	if ((result = resultset_create(variable_row, &context)) == NULL)
	{
		return NULL;
	}
	resultset_add_column(result, "Variable_name", 40, COL_TYPE_VARCHAR);
	resultset_add_column(result, "Value", 40, COL_TYPE_VARCHAR);
	return result;
}
Exemple #2
0
/**
 * Return a resultset that has the current set of services in it
 *
 * @return A Result set
 */
RESULTSET *
serviceGetList()
{
RESULTSET	*set;
int		*data;

	if ((data = (int *)malloc(sizeof(int))) == NULL)
		return NULL;
	*data = 0;
	if ((set = resultset_create(serviceRowCallback, data)) == NULL)
	{
		free(data);
		return NULL;
	}
	resultset_add_column(set, "Service Name", 25, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Router Module", 20, COL_TYPE_VARCHAR);
	resultset_add_column(set, "No. Sessions", 10, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Total Sessions", 10, COL_TYPE_VARCHAR);

	return set;
}
Exemple #3
0
/**
 * Execute a show variables command applying an optional filter
 *
 * @param dcb		The DCB connected to the client
 * @param filter	A potential like clause or NULL
 */
static void
exec_show_variables(DCB *dcb, MAXINFO_TREE *filter)
{
RESULTSET	*result;
VARCONTEXT	context;

	if (filter)
		context.like = filter->value;
	else
		context.like = NULL;
	context.index = 0;

	if ((result = resultset_create(variable_row, &context)) == NULL)
	{
		maxinfo_send_error(dcb, 0, "No resources available");
		return;
	}
	resultset_add_column(result, "Variable_name", 40, COL_TYPE_VARCHAR);
	resultset_add_column(result, "Value", 40, COL_TYPE_VARCHAR);
	resultset_stream_mysql(result, dcb);
	resultset_free(result);
}
Exemple #4
0
/**
 * Return a resultset that has the current set of services in it
 *
 * @return A Result set
 */
RESULTSET *
serviceGetListenerList()
{
RESULTSET	*set;
int		*data;

	if ((data = (int *)malloc(sizeof(int))) == NULL)
		return NULL;
	*data = 0;
	if ((set = resultset_create(serviceListenerRowCallback, data)) == NULL)
	{
		free(data);
		return NULL;
	}
	resultset_add_column(set, "Service Name", 25, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Protocol Module", 20, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Address", 15, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Port", 5, COL_TYPE_VARCHAR);
	resultset_add_column(set, "State", 8, COL_TYPE_VARCHAR);

	return set;
}
Exemple #5
0
/**
 * Return a resultset that has the current set of servers in it
 *
 * @return A Result set
 */
RESULTSET *
serverGetList()
{
RESULTSET	*set;
int		*data;

	if ((data = (int *)malloc(sizeof(int))) == NULL)
		return NULL;
	*data = 0;
	if ((set = resultset_create(serverRowCallback, data)) == NULL)
	{
		free(data);
		return NULL;
	}
	resultset_add_column(set, "Server", 20, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Address", 15, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Port", 5, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Connections", 8, COL_TYPE_VARCHAR);
	resultset_add_column(set, "Status", 20, COL_TYPE_VARCHAR);

	return set;
}
Exemple #6
0
/**
 * Return a resultset that has the current set of sessions in it
 *
 * @return A Result set
 */
RESULTSET *
sessionGetList(SESSIONLISTFILTER filter)
{
    RESULTSET *set;
    SESSIONFILTER *data;

    if ((data = (SESSIONFILTER *)malloc(sizeof(SESSIONFILTER))) == NULL)
    {
        return NULL;
    }
    data->index = 0;
    data->filter = filter;
    if ((set = resultset_create(sessionRowCallback, data)) == NULL)
    {
        free(data);
        return NULL;
    }
    resultset_add_column(set, "Session", 16, COL_TYPE_VARCHAR);
    resultset_add_column(set, "Client", 15, COL_TYPE_VARCHAR);
    resultset_add_column(set, "Service", 15, COL_TYPE_VARCHAR);
    resultset_add_column(set, "State", 15, COL_TYPE_VARCHAR);

    return set;
}
Exemple #7
0
/**
 * The hardwired select ... as starttime response
 *
 * @param dcb	The DCB of the client
 */
static void
respond_starttime(DCB *dcb)
{
RESULTSET *result;
int	context = 0;

	if ((result = resultset_create(starttime_row, &context)) == NULL)
	{
		maxinfo_send_error(dcb, 0, "No resources available");
		return;
	}
	resultset_add_column(result, "starttime", 40, COL_TYPE_VARCHAR);
	resultset_stream_mysql(result, dcb);
	resultset_free(result);
}