File: mg-test-common.c

package info (click to toggle)
mergeant 0.52-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,848 kB
  • ctags: 6,584
  • sloc: ansic: 63,372; xml: 23,218; sh: 8,316; makefile: 613; sql: 237
file content (46 lines) | stat: -rw-r--r-- 1,056 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "mg-test-common.h"
#include <string.h>

gchar *
get_first_datasource (void)
{
	gchar *str = NULL;
	GList *ds_list;
	GList *node;
	GdaDataSourceInfo *info;
              
	ds_list = gda_config_get_data_source_list ();
        node = g_list_first (ds_list);
	if (node) {
		info = (GdaDataSourceInfo *) node->data;
		str = g_strdup (info->name);
		g_print ("Using source:\n\tNAME: %s\n\tPROVIDER: %s\n\tCNC: %s\n\tDESC: %s\n\tUSER: %s\n",
			 info->name, info->provider, info->cnc_string, info->description,
			 info->username);
	}
	gda_config_free_data_source_list (ds_list);
	
	return str;
}

gchar *
get_datasource_user (const gchar *ds)
{
	gchar *str = NULL;

	GList *ds_list;
	GList *node;
	GdaDataSourceInfo *info;
              
	ds_list = gda_config_get_data_source_list ();
        node = g_list_first (ds_list);
	while (node && !str) {
		info = (GdaDataSourceInfo *) node->data;
		if (!strcmp (info->name, ds))
			str = g_strdup (info->username);
		node = g_list_next (node);
	}
	gda_config_free_data_source_list (ds_list);

	return str;
}